Refactor release workflow #1
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: release | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
maven-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Install Java and Maven | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Unsnapshot version | |
run: mvn versions:set -DremoveSnapshot | |
- name: Release Maven package | |
uses: samuelmeuli/action-maven-publish@v1 | |
with: | |
server_id: staging | |
maven_profiles: release | |
gpg_private_key: ${{ secrets.gpg_private_key }} | |
gpg_passphrase: ${{ secrets.gpg_passphrase }} | |
nexus_username: ${{ secrets.MAVEN_USERNAME }} | |
nexus_password: ${{ secrets.MAVEN_PASSWORD }} | |
github-release: | |
needs: [ maven-release ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Install Java and Maven | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Unsnapshot version | |
run: mvn versions:set -DremoveSnapshot | |
- id: get-version | |
uses: JActions/[email protected] | |
- name: Create Release | |
id: createRelease | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get-version.outputs.version }} | |
release_name: "Toolchain FitNesse Fixtures ${{ steps.get-version.outputs.version }}" | |
body: | |
draft: false | |
prerelease: false | |
update-version: | |
needs: [maven-release, github-release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Java and Maven | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Configure git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Praegus" | |
- name: Update version | |
run: | | |
mvn -B release:update-versions -DautoVersionSubmodules=true | |
git add pom.xml | |
git commit -m "Update version" | |
git push origin master |