|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: 'Release tag (e.g., v0.3.14)' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + packages: write |
| 17 | + id-token: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + goreleaser: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Set up Go |
| 29 | + uses: actions/setup-go@v5 |
| 30 | + with: |
| 31 | + go-version-file: go.mod |
| 32 | + cache: true |
| 33 | + |
| 34 | + - name: Install cross-compilers |
| 35 | + run: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi |
| 38 | +
|
| 39 | + - name: Set up QEMU |
| 40 | + uses: docker/setup-qemu-action@v3 |
| 41 | + |
| 42 | + - name: Import GPG key |
| 43 | + if: ${{ env.GPG_PRIVATE_KEY != '' }} |
| 44 | + id: import_gpg |
| 45 | + uses: crazy-max/ghaction-import-gpg@v6 |
| 46 | + with: |
| 47 | + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 48 | + passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 49 | + |
| 50 | + - name: Run GoReleaser |
| 51 | + uses: goreleaser/goreleaser-action@v6 |
| 52 | + with: |
| 53 | + version: latest |
| 54 | + args: release --clean |
| 55 | + env: |
| 56 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
| 58 | + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} |
| 59 | + |
| 60 | + # Signing jobs - uncomment after setting up certificates (see issue #733) |
| 61 | + # Instructions: https://github.com/benbjohnson/litestream/issues/733 |
| 62 | + # |
| 63 | + # macos-sign: |
| 64 | + # runs-on: macos-latest |
| 65 | + # needs: goreleaser |
| 66 | + # strategy: |
| 67 | + # matrix: |
| 68 | + # arch: [amd64, arm64] |
| 69 | + # steps: |
| 70 | + # - name: Checkout |
| 71 | + # uses: actions/checkout@v4 |
| 72 | + # |
| 73 | + # - name: Set up Go |
| 74 | + # uses: actions/setup-go@v5 |
| 75 | + # with: |
| 76 | + # go-version-file: go.mod |
| 77 | + # |
| 78 | + # - name: Download release artifacts |
| 79 | + # uses: actions/download-artifact@v4 |
| 80 | + # with: |
| 81 | + # name: litestream-darwin-${{ matrix.arch }} |
| 82 | + # path: dist/ |
| 83 | + # |
| 84 | + # - name: Import Apple Developer Certificate |
| 85 | + # env: |
| 86 | + # MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE_P12 }} |
| 87 | + # MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} |
| 88 | + # run: | |
| 89 | + # echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12 |
| 90 | + # security create-keychain -p actions temp.keychain |
| 91 | + # security default-keychain -s temp.keychain |
| 92 | + # security unlock-keychain -p actions temp.keychain |
| 93 | + # security import certificate.p12 -k temp.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign |
| 94 | + # security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k actions temp.keychain |
| 95 | + # |
| 96 | + # - name: Sign and Notarize |
| 97 | + # env: |
| 98 | + # APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_P8 }} |
| 99 | + # APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} |
| 100 | + # APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }} |
| 101 | + # AC_PASSWORD: ${{ secrets.AC_PASSWORD }} |
| 102 | + # run: | |
| 103 | + # gon etc/gon-${{ matrix.arch }}.hcl |
| 104 | + # |
| 105 | + # - name: Upload signed binary |
| 106 | + # env: |
| 107 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 108 | + # run: | |
| 109 | + # gh release upload ${{ github.ref_name }} dist/litestream-*-darwin-${{ matrix.arch }}.zip |
| 110 | + # |
| 111 | + # windows-sign: |
| 112 | + # runs-on: windows-latest |
| 113 | + # needs: goreleaser |
| 114 | + # strategy: |
| 115 | + # matrix: |
| 116 | + # arch: [amd64, arm64] |
| 117 | + # steps: |
| 118 | + # - name: Checkout |
| 119 | + # uses: actions/checkout@v4 |
| 120 | + # |
| 121 | + # - name: Download release artifacts |
| 122 | + # uses: actions/download-artifact@v4 |
| 123 | + # with: |
| 124 | + # name: litestream-windows-${{ matrix.arch }} |
| 125 | + # path: dist/ |
| 126 | + # |
| 127 | + # - name: Sign Windows binary |
| 128 | + # env: |
| 129 | + # WINDOWS_CERTIFICATE_PFX: ${{ secrets.WINDOWS_CERTIFICATE_PFX }} |
| 130 | + # WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} |
| 131 | + # run: | |
| 132 | + # echo "$env:WINDOWS_CERTIFICATE_PFX" | base64 -d > cert.pfx |
| 133 | + # & signtool sign /f cert.pfx /p "$env:WINDOWS_CERTIFICATE_PASSWORD" /fd SHA256 /td SHA256 /tr http://timestamp.digicert.com dist\litestream.exe |
| 134 | + # Remove-Item cert.pfx |
| 135 | + # |
| 136 | + # - name: Upload signed binary |
| 137 | + # env: |
| 138 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + # run: | |
| 140 | + # gh release upload ${{ github.ref_name }} dist\litestream-*-windows-${{ matrix.arch }}.zip |
0 commit comments