|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - goos: linux |
| 19 | + goarch: amd64 |
| 20 | + - goos: linux |
| 21 | + goarch: arm64 |
| 22 | + - goos: darwin |
| 23 | + goarch: amd64 |
| 24 | + notarize: true |
| 25 | + - goos: darwin |
| 26 | + goarch: arm64 |
| 27 | + notarize: true |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@34e1148 |
| 31 | + |
| 32 | + - name: Set up Go |
| 33 | + uses: actions/setup-go@40f1582 |
| 34 | + with: |
| 35 | + go-version-file: go.mod |
| 36 | + |
| 37 | + - name: Build binary |
| 38 | + env: |
| 39 | + GOOS: ${{ matrix.goos }} |
| 40 | + GOARCH: ${{ matrix.goarch }} |
| 41 | + CGO_ENABLED: "0" |
| 42 | + run: | |
| 43 | + mkdir -p dist |
| 44 | + go build -o "dist/apprise-go-${GOOS}-${GOARCH}" ./cmd/apprise |
| 45 | +
|
| 46 | + - name: Write signing certificate |
| 47 | + if: matrix.notarize |
| 48 | + env: |
| 49 | + APPLE_BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }} |
| 50 | + run: | |
| 51 | + printf '%s' "$APPLE_BUILD_CERTIFICATE_BASE64" | base64 --decode > apple_codesign.p12 |
| 52 | + chmod 600 apple_codesign.p12 |
| 53 | +
|
| 54 | + - name: Write App Store Connect API key |
| 55 | + if: matrix.notarize |
| 56 | + env: |
| 57 | + APP_STORE_CONNECT_KEY_JSON: ${{ secrets.APPLE_APP_STORE_CONNECT_KEY_JSON }} |
| 58 | + run: | |
| 59 | + printf '%s' "$APP_STORE_CONNECT_KEY_JSON" > app_store_connect_key.json |
| 60 | + chmod 600 app_store_connect_key.json |
| 61 | +
|
| 62 | + - name: Sign and notarize darwin binary |
| 63 | + if: matrix.notarize |
| 64 | + uses: indygreg/apple-code-sign-action@44d0985b |
| 65 | + with: |
| 66 | + input_path: dist/apprise-go-${{ matrix.goos }}-${{ matrix.goarch }} |
| 67 | + p12_file: apple_codesign.p12 |
| 68 | + p12_password: ${{ secrets.APPLE_BUILD_CERTIFICATE_PASSWORD }} |
| 69 | + notarize: true |
| 70 | + app_store_connect_api_key_json_file: app_store_connect_key.json |
| 71 | + |
| 72 | + - name: Cleanup signing materials |
| 73 | + if: always() |
| 74 | + run: rm -f apple_codesign.p12 app_store_connect_key.json |
| 75 | + |
| 76 | + - name: Upload release asset |
| 77 | + if: github.event_name == 'release' |
| 78 | + uses: softprops/action-gh-release@a06a81a0 |
| 79 | + with: |
| 80 | + files: dist/apprise-go-${{ matrix.goos }}-${{ matrix.goarch }} |
| 81 | + |
| 82 | + - name: Upload artifact |
| 83 | + if: github.event_name != 'release' |
| 84 | + uses: actions/upload-artifact@ea165f8d |
| 85 | + with: |
| 86 | + name: apprise-go-${{ matrix.goos }}-${{ matrix.goarch }} |
| 87 | + path: dist/apprise-go-${{ matrix.goos }}-${{ matrix.goarch }} |
0 commit comments