Release next version #4
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 next version | |
on: workflow_dispatch | |
jobs: | |
build: | |
name: Build ${{ github.run_number }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Get previous tag | |
id: previoustag | |
uses: 'WyriHaximus/github-action-get-previous-tag@v1' | |
with: | |
fallback: '0.0.0' # Fallback tag when no previous tag is found | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get next version | |
id: semver | |
uses: 'WyriHaximus/github-action-next-semvers@v1' | |
with: | |
version: ${{ steps.previoustag.outputs.tag }} | |
- name: Change Version | |
run: mvn versions:set -DnewVersion=${{ steps.semver.outputs.patch }} | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Test with Maven | |
run: mvn test | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.semver.outputs.patch }} | |
release_name: Release ${{ steps.semver.outputs.patch }} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHATKN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/waypoint-replace-${{ steps.semver.outputs.patch }}.jar | |
asset_name: waypoint-replace-${{ steps.semver.outputs.patch }}.jar | |
asset_content_type: application/java-archive |