Merge remote-tracking branch 'origin/master' #2
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
| # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | |
| # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | |
| name: Maven Package | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v2 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| server-id: github | |
| - name: Increment the version number | |
| id: incVer | |
| run: | | |
| mvn validate -DincrementBuild | |
| mvn versions:commit | |
| APPLICATION_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
| git config user.name github-actions | |
| git config user.email [email protected] | |
| git add pom.xml | |
| git commit -m "[skip ci]" | |
| git tag -a v$APPLICATION_VERSION -m "Release v$APPLICATION_VERSION" | |
| echo "::set-output name=application_version::v$APPLICATION_VERSION" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} | |
| tags: true | |
| - name: Build with Maven | |
| run: mvn --batch-mode clean compile package | |
| - name: Create release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: ${{ steps.incVer.outputs.application_version }} | |
| files: target/*.jar | |
| tag_name: refs/tags/${{ steps.incVer.outputs.application_version }} | |
| - name: Publish package | |
| run: mvn --batch-mode deploy | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |