Skip to content

Commit

Permalink
chore: fix release workflow (#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou committed Dec 10, 2022
1 parent 0735ed3 commit 655d2fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 2 additions & 0 deletions cliff-release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 2 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 655d2fd

Please sign in to comment.