Skip to content

Commit 2216253

Browse files
committed
Update release workflow
1 parent 9687130 commit 2216253

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

.github/utils/update_version.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ echo -e "\n### Setting commit user ###"
55
git config --global user.email "${GIT_USER_EMAIL}"
66
git config --global user.name "${GIT_USER_NAME}"
77

8-
echo -e "\n### Update version in README ###"
9-
invoke update-version --version="${GITHUB_REF#refs/tags/}"
8+
ref=${GITHUB_REF#refs/tags/}
9+
10+
echo -e "\n### Update version to ${ref} ###"
11+
invoke update-version --version="${ref}"
1012

1113
echo -e "\n### Commit update ###"
1214
git add push_action/__init__.py
1315
git add CHANGELOG.md
14-
git commit -m "Release ${GITHUB_REF#refs/tags/}"
16+
git commit -m "Release ${ref}"
1517

1618
echo -e "\n### Create new full version (v<MAJOR>.<MINOR>.<PATCH>) tag ###"
1719
TAG_MSG=.github/utils/release_tag_msg.txt
18-
sed -i "s|TAG_NAME|${GITHUB_REF#refs/tags/}|g" "${TAG_MSG}"
20+
sed -i "s|TAG_NAME|${ref}|g" "${TAG_MSG}"
1921

20-
git tag -af -F "${TAG_MSG}" ${GITHUB_REF#refs/tags/}
22+
git tag -af -F "${TAG_MSG}" ${ref}
2123

2224
echo -e "\n### Move/update v<MAJOR> tag ###"
2325
MAJOR_VERSION=$( echo ${GITHUB_REF#refs/tags/v} | cut -d "." -f 1 )

.github/workflows/cd_release.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
PUBLISH_UPDATE_BRANCH: main
1010
GIT_USER_NAME: CasperWA
1111
GIT_USER_EMAIL: "[email protected]"
12+
EXCLUDE_TAGS_REGEX: "^(ci_test|master|v[0-9]+)$"
1213

1314
jobs:
1415
update-repo-and-release:
@@ -18,27 +19,26 @@ jobs:
1819

1920
steps:
2021
- name: Checkout repository
21-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2223
with:
2324
fetch-depth: 0
2425

2526
- name: Set up Python 3.12
26-
uses: actions/setup-python@v5
27+
uses: actions/setup-python@v6
2728
with:
2829
python-version: '3.12'
2930

3031
- name: Install Python dependencies
3132
run: |
3233
python -m pip install -U pip
3334
pip install -U setuptools wheel
34-
pip install -U -e .[dev]
35+
pip install .[dev]
36+
pip install flit
3537
3638
- name: Update changelog
37-
uses: CharMixer/auto-changelog-action@v1
39+
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
3840
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
40-
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
41-
exclude_tags_regex: "^(ci_test|master|v[0-9]+)$"
41+
args: --user "CasperWA" --project push-protected --token "${{ secrets.GITHUB_TOKEN }}" --release-branch "${{ env.PUBLISH_UPDATE_BRANCH }}" --exclude-tags-regex "${{ env.EXCLUDE_TAGS_REGEX }}"
4242

4343
- name: Update version and tags
4444
run: .github/utils/update_version.sh
@@ -54,16 +54,16 @@ jobs:
5454
tags: true
5555

5656
- name: Get tagged versions
57-
run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_ENV
57+
id: tagged_versions
58+
run: |
59+
PREVIOUS_VERSION="$(git tag -l --sort -version:refname | grep -v -e "${{ env.EXCLUDE_TAGS_REGEX }}" | sed -n 2p)"
60+
61+
echo "since_previous_version=--since-tag=${PREVIOUS_VERSION}" >> $GITHUB_OUTPUT
5862
5963
- name: Create release-specific changelog
60-
uses: CharMixer/auto-changelog-action@v1
64+
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
6165
with:
62-
token: ${{ secrets.GITHUB_TOKEN }}
63-
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
64-
since_tag: "${{ env.PREVIOUS_VERSION }}"
65-
output: "release_changelog.md"
66-
exclude_tags_regex: "^(ci_test|master|v[0-9]+)$"
66+
args: --user "CasperWA" --project push-protected --token "${{ secrets.GITHUB_TOKEN }}" --release-branch "${{ env.PUBLISH_UPDATE_BRANCH }}" ${{ steps.tagged_versions.outputs.since_previous_version }} --output release_changelog.md --usernames-as-github-logins --exclude-tags-regex "${{ env.EXCLUDE_TAGS_REGEX }}"
6767

6868
- name: Append changelog to release body
6969
run: |

0 commit comments

Comments
 (0)