Build Jar #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: Build Jar | |
on: | |
workflow_dispatch: # for manual trigger | |
push: | |
tags: | |
- 'v*' # for semantic versioning tags | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Extract tag name | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Update pom.xml with the tag version | |
run: mvn versions:set -DnewVersion=${{ env.VERSION }} | |
- name: Build with Maven | |
run: mvn clean package | |
- name: Clean up artifacts | |
run: rm target/original-*.jar | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Build Artifacts | |
path: | | |
target/*.jar |