Create Release #78
This file contains 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 | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
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: 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 }} | |
- 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 | |
}); | |
- name: Publish artefact to QBiC Nexus Repository | |
run: VAADIN_OFFLINE_KEY=${{ secrets.VAADIN_SERVER_23_2 }} mvn --quiet --settings $GITHUB_WORKSPACE/.github.settings.xml -Pproduction -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' | |
}); |