Create Release #137
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: Create Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| versionTag: | |
| description: 'Version Tag (semantic version)' | |
| required: true | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| attestations: write # required for provenance | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '21' | |
| settings-path: ${{ github.workspace }} | |
| - name: Load local Maven repository cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Debug OIDC (get a token) | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const token = await core.getIDToken('sigstore'); // audience example | |
| core.setSecret(token); | |
| console.log('OIDC token acquired. Length:', token.length); | |
| - name: Set up git | |
| run: | | |
| git config --global user.email "support@qbic.zendesk.com" | |
| git config --global user.name "JohnnyQ5" | |
| - name: Set version in Maven project | |
| run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }} -DprocessAllModules | |
| - name: Build with Maven | |
| run: VAADIN_OFFLINE_KEY=${{ secrets.VAADIN_SERVER_23_2 }} mvn -B package -Pproduction -Dvaadin.force.production.build=true --file pom.xml | |
| - name: Create Release Notes | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') | |
| && !( contains(github.event.inputs.versionTag, 'alpha') | |
| || contains(github.event.inputs.versionTag, 'beta') | |
| || contains(github.event.inputs.versionTag, 'rc')) }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} | |
| script: | | |
| await github.request(`POST /repos/${{ github.repository }}/releases`, { | |
| tag_name: "${{ github.event.inputs.versionTag }}", | |
| generate_release_notes: true | |
| }); | |
| - name: Create Pre-Release Notes | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') | |
| && ( contains(github.event.inputs.versionTag, 'alpha') | |
| || contains(github.event.inputs.versionTag, 'beta') | |
| || contains(github.event.inputs.versionTag, 'rc')) }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} | |
| script: | | |
| await github.request(`POST /repos/${{ github.repository }}/releases`, { | |
| tag_name: "${{ github.event.inputs.versionTag }}", | |
| generate_release_notes: true, | |
| prerelease: true | |
| }); | |
| # Generate provenance (SLSA attestation) for all JARs | |
| - name: Generate SLSA build provenance | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: "**/target/*.jar" | |
| - name: Publish artefact to QBiC Nexus Repository | |
| run: mvn --quiet --settings $GITHUB_WORKSPACE/.github.settings.xml -Pproduction -DskipTests -Dvaadin.force.production.build=true deploy | |
| env: | |
| MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
| MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |
| - name: Switch to new branch | |
| run: git checkout -b release/set-version-to-${{ github.event.inputs.versionTag }} | |
| - name: Set remote branch | |
| run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }} | |
| - name: Checkin commit | |
| run: git commit . -m 'Set version to ${{ github.event.inputs.versionTag }}' | |
| - name: Push to Github | |
| run: git push | |
| - name: Open PR with version bump | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} | |
| script: | | |
| await github.request(`POST /repos/${{ github.repository }}/pulls`, { | |
| title: 'Update version to ${{ github.event.inputs.versionTag }}', | |
| head: 'release/set-version-to-${{ github.event.inputs.versionTag }}', | |
| base: 'main' | |
| }); |