Skip to content

Commit f8f328c

Browse files
committed
ci: cleaner release flow
1 parent deefba4 commit f8f328c

File tree

2 files changed

+56
-32
lines changed

2 files changed

+56
-32
lines changed

.github/workflows/ci.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,45 @@ on:
77
pull_request:
88
branches: [main]
99

10+
concurrency:
11+
group: ${{ github.event.number }}
12+
cancel-in-progress: true
13+
1014
jobs:
15+
preview:
16+
name: Release preview
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
20+
with:
21+
fetch-depth: 0
22+
- name: Generate notes
23+
id: notes
24+
uses: open-turo/actions-release/semantic-release@v4
25+
with:
26+
# branches: ${{ github.head_ref }}
27+
override-github-ref-name: ${{ github.head_ref }}
28+
dry-run: true
29+
ci: false
30+
- name: Find Comment
31+
uses: peter-evans/find-comment@v2
32+
id: find
33+
with:
34+
issue-number: ${{ github.event.pull_request.number }}
35+
body-includes: release-notes-preview
36+
- name: Comment preview
37+
uses: peter-evans/create-or-update-comment@v1
38+
with:
39+
comment-id: ${{ steps.find.outputs.comment-id }}
40+
issue-number: ${{ github.event.number }}
41+
edit-mode: replace
42+
body: |
43+
<!-- release-notes-preview -->
44+
45+
## Release notes preview
46+
47+
${{ steps.notes.outputs.new-release-notes }}
48+
1149
lint:
1250
name: Lint
1351
runs-on: ubuntu-latest

.github/workflows/release.yaml

+18-32
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
branches: [main]
77

8+
concurrency:
9+
group: release
10+
811
jobs:
912
ci:
1013
name: CI
@@ -32,46 +35,29 @@ jobs:
3235
run: poetry install
3336
- name: Find version
3437
id: version
35-
uses: cycjimmy/semantic-release-action@v3
38+
uses: open-turo/actions-release/semantic-release@v4
3639
with:
37-
dry_run: true
38-
branches: |
39-
["main"]
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
# branches: ${{ github.head_ref }}
42+
# override-github-ref-name: ${{ github.head_ref }}
43+
dry-run: true
44+
ci: false
45+
- name: Release check
46+
if: steps.version.outputs.new-release-published != 'true'
47+
run: exit 1
4248
- name: Update version
43-
if: steps.version.outputs.new_release_published == 'true'
4449
shell: bash
45-
run: |
46-
# Use poetry to bump the version in pyproject.toml
47-
poetry version "${{ steps.version.outputs.new_release_version }}"
48-
49-
50-
NAME="Jake Alheid"
51-
52-
# Set our git config for pushing
53-
git config user.email "$EMAIL"
54-
git config user.name "$NAME"
55-
56-
# Commit the bumped project version with a non-semver chore: commit message
57-
git add pyproject.toml
58-
git --no-pager diff --staged
59-
git commit \
60-
--author="$NAME <$EMAIL>" \
61-
-m "chore: release ${{ steps.version.outputs.new_release_version }}" \
62-
-m "[skip actions]"
63-
64-
git push || { echo "::error:: Failed to push version update for pyproject.toml, check your github-token permissions, or branch protections."; exit 1; }
65-
66-
# Nice logging, generate success exit code from this run step
67-
echo "::notice::Version successfully updated in pyproject.toml to ${{ steps.version.outputs.new_release_version }}."
50+
run: poetry version "${{ steps.version.outputs.new-release-version }}"
51+
- name: Commit & push version
52+
uses: actions-js/push@master
53+
with:
54+
message: "chore: ${{ steps.version.outputs.new-release-version }} [skip actions]"
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
6856
- name: Poetry build
6957
run: poetry build
7058
- name: Publish to PyPI
71-
if: steps.version.outputs.new_release_published == 'true'
7259
uses: pypa/gh-action-pypi-publish@release/v1
7360
- name: Release
74-
if: steps.version.outputs.new_release_published == 'true'
7561
uses: cycjimmy/semantic-release-action@v3
7662
env:
7763
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)