From 655d2fd339da79e2ad813238b5f300a18d93139d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 10 Dec 2022 18:53:47 +0100 Subject: [PATCH] chore: fix release workflow (#1190) --- .github/workflows/release.yml | 22 ++++++++++++++++------ cliff-release.toml | 2 ++ cliff.toml | 2 ++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d4ea2b4e..9fcc34df8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,18 +18,23 @@ jobs: token: ${{ secrets.PAT }} ref: 'develop' + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@main + - name: Push version number + if: steps.package-version.outputs.current-version != github.event.inputs.version shell: bash run: | npm version --no-git-tag-version ${{ github.event.inputs.version }} - name: git add & commit & push + if: steps.package-version.outputs.current-version != github.event.inputs.version uses: EndBug/add-and-commit@v9 with: add: 'package.json package-lock.json' default_author: github_actions message: 'chore: push version number to v${{ github.event.inputs.version }}' - tag: 'v${{ github.event.inputs.version }}' push: true update-master-branch: @@ -38,7 +43,7 @@ jobs: steps: - uses: everlytic/branch-merge@1.1.5 with: - github_token: ${{ github.token }} + github_token: ${{ secrets.PAT }} source_ref: 'develop' target_branch: 'master' commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' @@ -68,14 +73,18 @@ jobs: shell: bash run: mv ./dist/mainsail.zip ./mainsail.zip + - name: Get latest tag + id: latest_tag + shell: bash + run: | + echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT + - name: Generate a changelog uses: orhun/git-cliff-action@v1 id: generate-changelog with: config: ./cliff-release.toml - args: -vv --latest --strip header - env: - output: CHANGES.md + args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD - name: Create release and upload build uses: softprops/action-gh-release@v1 @@ -117,6 +126,7 @@ jobs: shell: bash run: | echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT + - name: Generate a changelog uses: orhun/git-cliff-action@v1 id: git-cliff @@ -131,5 +141,5 @@ jobs: cat CHANGELOG.md - uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: 'chore(changelog): update changelog' + commit_message: 'docs(changelog): update changelog' file_pattern: CHANGELOG.md diff --git a/cliff-release.toml b/cliff-release.toml index 67376463f..10837c0f2 100644 --- a/cliff-release.toml +++ b/cliff-release.toml @@ -47,6 +47,8 @@ filter_unconventional = true # regex for parsing and grouping commits commit_parsers = [ { message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits { message = "^feat(\\(.*\\))?:", group = "1$Features"}, { message = "^feature(\\(.*\\))?:", group = "1$Features"}, { message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"}, diff --git a/cliff.toml b/cliff.toml index 119c67124..d218985a3 100644 --- a/cliff.toml +++ b/cliff.toml @@ -53,6 +53,8 @@ filter_unconventional = false # regex for parsing and grouping commits commit_parsers = [ { message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits { message = "^feat(\\(.*\\))?:", group = "1$Features"}, { message = "^feature(\\(.*\\))?:", group = "1$Features"}, { message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},