Skip to content

Commit

Permalink
Improve release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
anarsultanov committed Aug 18, 2023
1 parent 811a808 commit 56f5dac
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: "Release"

on:
push:
tags:
- "v*.*.*"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
Expand All @@ -19,8 +19,30 @@ jobs:
distribution: 'temurin'
cache: maven

- name: Git Version
id: version
uses: codacy/[email protected]
with:
release-branch: main

- name: "Generate changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fromTag: ${{ steps.version.outputs.previous-version }}
toTag: ${{ github.ref }}
commitMode: true
configurationJson: |
{
"template": "## What's Changed\n#{{UNCATEGORIZED}}",
"pr_template": "- #{{TITLE}}",
"categories": []
}
- name: Update POM Version
run: mvn org.codehaus.mojo:versions-maven-plugin:2.8.1:set -DnewVersion=${{ github.ref_name }}
shell: bash
run: mvn versions:set -DnewVersion=${{ steps.version.outputs.version }}

- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
Expand All @@ -35,9 +57,17 @@ jobs:
path: staging
retention-days: 1

- name: Commit New Version
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: Set version to ${{ steps.version.outputs.version }}"
file_pattern: 'pom.xml docs/openapi.json docs/openapi.yaml'

- name: Create GitHub release
uses: marvinpinto/action-automatic-releases@latest
uses: softprops/action-gh-release@v1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: staging/*.jar
tag_name: ${{ steps.version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
files: staging/*.jar
body: ${{steps.build_changelog.outputs.changelog}}

0 comments on commit 56f5dac

Please sign in to comment.