| 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. v1.0.0)" |
| 11 | required: true |
| 12 | |
| 13 | permissions: |
| 14 | contents: write |
| 15 | |
| 16 | jobs: |
| 17 | verify: |
| 18 | name: Verify release package and example |
| 19 | runs-on: macos-latest |
| 20 | |
| 21 | steps: |
| 22 | - name: Checkout |
| 23 | uses: actions/checkout@v6 |
| 24 | with: |
| 25 | ref: ${{ github.event.inputs.tag || github.ref }} |
| 26 | |
| 27 | - name: Show Swift version |
| 28 | run: swift --version |
| 29 | |
| 30 | - name: Verify package |
| 31 | run: make verify |
| 32 | |
| 33 | verify-apple-destinations: |
| 34 | name: Verify release Apple destination build (${{ matrix.platform }}) |
| 35 | needs: verify |
| 36 | runs-on: macos-latest |
| 37 | strategy: |
| 38 | fail-fast: false |
| 39 | matrix: |
| 40 | platform: |
| 41 | - ios |
| 42 | - tvos |
| 43 | - visionos |
| 44 | |
| 45 | steps: |
| 46 | - name: Checkout |
| 47 | uses: actions/checkout@v6 |
| 48 | with: |
| 49 | ref: ${{ github.event.inputs.tag || github.ref }} |
| 50 | |
| 51 | - name: Show Swift version |
| 52 | run: swift --version |
| 53 | |
| 54 | - name: Verify destination build |
| 55 | run: make verify-apple-destination PLATFORM=${{ matrix.platform }} |
| 56 | |
| 57 | github-release: |
| 58 | name: Create GitHub release |
| 59 | needs: |
| 60 | - verify |
| 61 | - verify-apple-destinations |
| 62 | runs-on: ubuntu-latest |
| 63 | |
| 64 | steps: |
| 65 | - name: Resolve tag |
| 66 | id: tag |
| 67 | shell: bash |
| 68 | run: | |
| 69 | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then |
| 70 | echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" |
| 71 | else |
| 72 | echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" |
| 73 | fi |
| 74 | |
| 75 | - name: Create release |
| 76 | uses: softprops/action-gh-release@v2 |
| 77 | with: |
| 78 | tag_name: ${{ steps.tag.outputs.tag }} |
| 79 | generate_release_notes: true |