|
| 1 | +--- |
| 2 | +name: Release |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["ci", "examples"] |
| 6 | + branches: [main] |
| 7 | + types: |
| 8 | + - completed |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | +jobs: |
| 12 | + release: |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v5 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + - name: Build project |
| 19 | + run: | |
| 20 | + make examples/plugin.wasm |
| 21 | + - name: Bump version and push tag |
| 22 | + uses: anothrNick/[email protected] |
| 23 | + id: version |
| 24 | + env: |
| 25 | + GITHUB_TOKEN: ${{ github.token }} |
| 26 | + WITH_V: true |
| 27 | + DEFAULT_BUMP: patch |
| 28 | + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} |
| 29 | + RELEASE_BRANCHES: main |
| 30 | + - name: Create release |
| 31 | + id: create_release |
| 32 | + uses: actions/github-script@v8 |
| 33 | + if: ${{ steps.version.outputs.new_tag }} |
| 34 | + env: |
| 35 | + RELEASE_TAG: ${{ steps.version.outputs.new_tag }} |
| 36 | + with: |
| 37 | + script: | |
| 38 | + try { |
| 39 | + await github.rest.repos.createRelease({ |
| 40 | + draft: false, |
| 41 | + generate_release_notes: true, |
| 42 | + name: process.env.RELEASE_TAG, |
| 43 | + owner: context.repo.owner, |
| 44 | + prerelease: false, |
| 45 | + repo: context.repo.repo, |
| 46 | + tag_name: process.env.RELEASE_TAG, |
| 47 | + }); |
| 48 | + } catch (error) { |
| 49 | + core.setFailed(error.message); |
| 50 | + } |
| 51 | + - name: Upload Release Asset |
| 52 | + id: upload-release-asset |
| 53 | + uses: actions/upload-release-asset@v1 |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + with: |
| 57 | + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 58 | + asset_path: ./examples/plugin.wasm |
| 59 | + asset_name: plugin.wasm |
| 60 | + asset_content_type: application/wasm |
0 commit comments