Skip to content

Commit 51b4f4f

Browse files
committed
feat: release the package from the CI with trusted provider
1 parent 35f6860 commit 51b4f4f

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release on tag
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.11"
23+
24+
- name: Install dependencies
25+
run: pip install hatch
26+
27+
- name: Build the library
28+
run: hatch build
29+
30+
- name: Publish package distributions to TestPyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
33+
- name: Create a draft release
34+
run: |
35+
NEW_VERSION=$(hatch project metadata | jq -r '.version')
36+
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/release.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@ git diff --exit-code
1515
git commit -am "Release v$NEW_VERSION 🚀"
1616
git tag v$NEW_VERSION -m "Release v$NEW_VERSION 🚀"
1717
git push --follow-tags
18-
hatch build
19-
hatch publish
20-
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d

0 commit comments

Comments
 (0)