Tagged Release #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tagged Release | |
| on: | |
| # when a semver tag is pushed this runs automatically | |
| push: | |
| tags: | |
| - '[0-9]+.[0-9]+.[0-9]+' | |
| # or when invoked manually a preview release is created | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Mount bazel cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/bazel | |
| ~/.cache/bazelisk | |
| key: bazel | |
| - name: Build JdtJavaBuilder_deploy.jar | |
| run: | | |
| bazelisk build --config=ci :JdtJavaBuilder_deploy.jar | |
| cp -fv bazel-bin/JdtJavaBuilder_deploy.jar compiler/export/ | |
| - name: Test Compile | |
| run: | | |
| cd examples/ | |
| bazelisk test //... | |
| - name: Build Distribution | |
| run: | | |
| bazelisk build //dist:all | |
| - name: Replace version with tag info | |
| # more inspiration at https://blog.pusher.com/continuous-releases-github-actions/ | |
| if: github.ref_type == 'tag' | |
| run: | | |
| sed -i "s|/latest/|/${{ github.ref_name }}/|" bazel-bin/dist/relnotes.txt | |
| - name: Publish Draft Release for tag | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref_type == 'tag' | |
| with: | |
| draft: true | |
| body_path: bazel-bin/dist/relnotes.txt | |
| files: | | |
| LICENSE | |
| bazel-bin/dist/rules_jdt-*.tar.gz | |
| bazel-bin/dist/changelog.txt | |
| - name: Publish Pre-Release for main branch | |
| uses: softprops/action-gh-release@v2 | |
| if: ${{ github.ref_type == 'branch' && github.ref_name == 'main' }} | |
| with: | |
| tag_name: "${{ github.ref_name }}" | |
| prerelease: true | |
| body_path: bazel-bin/dist/relnotes.txt | |
| files: | | |
| LICENSE | |
| bazel-bin/dist/rules_jdt-*.tar.gz | |
| bazel-bin/dist/changelog.txt |