Skip to content

Commit 9dc2d79

Browse files
committed
fix: deployment pipeline
1 parent 6edbc91 commit 9dc2d79

File tree

1 file changed

+19
-100
lines changed

1 file changed

+19
-100
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,11 @@ jobs:
1919
dist_artifacts_dir: dist
2020
lock_file_artifact: uv.lock
2121
steps:
22-
- uses: actions/create-github-app-token@v2
23-
id: app-token
24-
with:
25-
app-id: ${{ secrets.APP_ID }}
26-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
27-
owner: ${{ github.repository_owner }}
28-
repositories: scaffoldr
2922
- name: Check out repository
3023
uses: actions/checkout@v5
3124
with:
3225
ref: ${{ github.ref }}
33-
token: ${{ steps.app-token.outputs.token }}
26+
token: ${{ secrets.GH_TOKEN }}
3427
fetch-depth: 0
3528

3629
- name: Configure Git user
@@ -49,99 +42,25 @@ jobs:
4942
- name: Install dependencies
5043
run: uv sync --all-extras --group dev
5144

52-
- name: Detect next version
53-
id: version
54-
env:
55-
GH_TOKEN: "none" # Prevents accidental push
56-
run: |
57-
uv run semantic-release -v version --no-commit --no-tag
58-
echo "Check Outputs: ${{ steps.version.outputs }}"
59-
echo "Check Outputs: ${{ steps.version.outputs.released }}"
60-
61-
# Assuming this step sets outputs like 'released', 'version', 'tag', 'is_prerelease' via $GITHUB_OUTPUT parsing.
62-
# If not, add e.g.: echo "released=true" >> $GITHUB_OUTPUT (adjust based on your logic).
63-
64-
- name: Upload lock file artifact (if needed for release)
65-
if: ${{ steps.version.outputs.released == 'true' }}
66-
uses: actions/upload-artifact@v4
45+
- name: Action | Semantic Version Release
46+
id: release
47+
uses: python-semantic-release/python-semantic-release@v10.4.1
6748
with:
68-
name: ${{ env.lock_file_artifact }}
69-
path: ${{ env.lock_file_artifact }}
70-
if-no-files-found: error
71-
retention-days: 2
72-
73-
outputs:
74-
new-release-detected: ${{ steps.version.outputs.released }}
75-
new-release-version: ${{ steps.version.outputs.version }}
76-
new-release-tag: ${{ steps.version.outputs.tag }}
77-
new-release-is-prerelease: ${{ steps.version.outputs.is_prerelease }}
78-
lock-file-artifact: ${{ env.lock_file_artifact }}
79-
80-
release:
81-
runs-on: ubuntu-latest
82-
needs:
83-
- build
84-
if: ${{ needs.build.outputs.new-release-detected == 'true' }}
85-
concurrency:
86-
group: ${{ github.workflow }}-release-${{ github.ref_name }}
87-
cancel-in-progress: false
88-
permissions:
89-
contents: write
90-
91-
steps:
92-
- uses: actions/create-github-app-token@v2
93-
id: app-token
94-
with:
95-
app-id: ${{ secrets.APP_ID }}
96-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
97-
owner: ${{ github.repository_owner }}
98-
repositories: scaffoldr
99-
100-
- name: Check out repository
101-
uses: actions/checkout@v5
49+
github_token: ${{ secrets.GH_TOKEN }}
50+
git_committer_name: "github-actions"
51+
git_committer_email: "actions@users.noreply.github.com"
52+
changelog: true
53+
54+
- name: Publish | Upload to GitHub Release Assets
55+
uses: python-semantic-release/publish-action@v10.4.1
56+
if: steps.release.outputs.released == 'true'
10257
with:
103-
ref: ${{ github.ref }}
104-
token: ${{ steps.app-token.outputs.token }}
105-
fetch-depth: 0
58+
github_token: ${{ secrets.GH_TOKEN }}
59+
tag: ${{ steps.release.outputs.tag }}
10660

107-
- name: Configure Git user
108-
run: |
109-
git config user.name "github-actions[bot]"
110-
git config user.email "github-actions[bot]@users.noreply.github.com"
111-
112-
- name: Install uv
113-
uses: astral-sh/setup-uv@v5
61+
- name: Upload | Distribution Artifacts
62+
uses: actions/upload-artifact@v4
11463
with:
115-
pyproject-file: "pyproject.toml"
116-
python-version: "3.13"
117-
enable-cache: true
118-
cache-dependency-glob: "**/pyproject.toml"
119-
120-
- name: Install dependencies
121-
run: uv sync --all-extras --group dev
122-
123-
- name: Update version and commit/tag/push
124-
env:
125-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126-
run: uv run semantic-release -vv version # Updates pyproject.toml, commits, tags, pushes
127-
128-
- name: Build artifacts with new version
129-
run: uv build # Builds dist/ with the updated version from pyproject.toml
130-
131-
- name: Generate changelog
132-
env:
133-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134-
run: uv run semantic-release -vv --strict changelog # Generates/updates CHANGELOG.md
135-
136-
- name: Amend commit with changelog and lock file
137-
run: |
138-
git add CHANGELOG.md uv.lock
139-
git commit --amend --no-edit
140-
git tag ${{ needs.build.outputs.new-release-tag }} --force
141-
git push --force-with-lease
142-
git push --tags --force
143-
144-
- name: Publish release
145-
env:
146-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147-
run: uv run semantic-release -vv publish # Uploads dist/ to GitHub Release
64+
name: distribution-artifacts
65+
path: dist
66+
if-no-files-found: error

0 commit comments

Comments
 (0)