Skip to content

Commit cb6d140

Browse files
committed
fix: release workflow
1 parent 171b6df commit cb6d140

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

.github/workflows/release.yml

+34-13
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,52 @@ jobs:
1414
run: |
1515
sudo apt update
1616
sudo apt install -y git
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.10'
22+
1723
- name: Install uv
1824
uses: astral-sh/setup-uv@v3
25+
1926
- name: Install Node Env
2027
uses: actions/setup-node@v4
2128
with:
2229
node-version: 20
30+
2331
- name: Checkout
2432
uses: actions/[email protected]
2533
with:
2634
fetch-depth: 0
2735
persist-credentials: false
28-
- name: Build app
36+
37+
- name: Install dependencies
2938
run: |
39+
uv pip install build hatchling hatch-vcs
3040
uv sync --frozen
31-
uv build
41+
42+
- name: Build package
43+
run: python -m build
3244
id: build_cache
33-
if: success()
34-
- name: Cache build
35-
uses: actions/cache@v2
45+
46+
- name: Cache build artifacts
47+
uses: actions/cache@v3
3648
with:
37-
path: ./dist
38-
key: ${{ runner.os }}-build-${{ hashFiles('dist/**') }}
39-
if: steps.build_cache.outputs.id != ''
49+
path: |
50+
./dist
51+
./build
52+
key: ${{ runner.os }}-build-${{ github.sha }}
4053

4154
release:
4255
name: Release
4356
runs-on: ubuntu-latest
4457
needs: build
4558
environment: development
46-
if: |
47-
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
48-
github.event_name == 'push' && github.ref == 'refs/heads/pre/beta' ||
49-
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' ||
50-
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'pre/beta'
59+
if: |
60+
github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/pre/')) ||
61+
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged &&
62+
(github.event.pull_request.base.ref == 'main' || startsWith(github.event.pull_request.base.ref, 'pre/'))
5163
permissions:
5264
contents: write
5365
issues: write
@@ -59,6 +71,15 @@ jobs:
5971
with:
6072
fetch-depth: 0
6173
persist-credentials: false
74+
75+
- name: Restore build artifacts
76+
uses: actions/cache@v3
77+
with:
78+
path: |
79+
./dist
80+
./build
81+
key: ${{ runner.os }}-build-${{ github.sha }}
82+
6283
- name: Semantic Release
6384
uses: cycjimmy/[email protected]
6485
with:

0 commit comments

Comments
 (0)