Skip to content

Commit 87e7cc5

Browse files
committed
fix: fix release action
1 parent 3e28562 commit 87e7cc5

File tree

1 file changed

+52
-23
lines changed

1 file changed

+52
-23
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch: # Manual trigger for testing
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
issues: read
13+
pull-requests: read
714

815
jobs:
9-
test-matrix:
16+
test:
1017
runs-on: ${{ matrix.os }}
1118
strategy:
1219
matrix:
@@ -19,42 +26,64 @@ jobs:
1926
python-version: ${{ matrix.python-version }}
2027
- name: Install Poetry
2128
run: pip install poetry
22-
- name: Cache dependencies
23-
uses: actions/cache@v4
24-
with:
25-
path: |
26-
~/.cache/pypoetry
27-
~/.local/share/pypoetry
28-
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
29-
restore-keys: ${{ runner.os }}-poetry-${{ matrix.python-version }}-
3029
- name: Install dependencies
3130
run: poetry install
3231
- name: Run tests
3332
run: poetry run pytest
3433

35-
build:
36-
needs: test-matrix
34+
release:
35+
needs: test
3736
runs-on: ubuntu-latest
37+
if: startsWith(github.ref, 'refs/tags/v')
3838
steps:
3939
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
token: ${{ secrets.PAT_TOKEN }}
43+
4044
- uses: actions/setup-python@v5
4145
with:
4246
python-version: "3.11"
47+
4348
- name: Install Poetry
4449
run: pip install poetry
45-
- name: Cache dependencies
46-
uses: actions/cache@v4
47-
with:
48-
path: |
49-
~/.cache/pypoetry
50-
~/.local/share/pypoetry
51-
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
52-
restore-keys: ${{ runner.os }}-poetry-
50+
5351
- name: Install dependencies
5452
run: poetry install
53+
5554
- name: Build package
5655
run: poetry build
57-
- name: Publish to PyPI
58-
env:
59-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
60-
run: poetry publish
56+
57+
- name: Extract release notes
58+
id: extract-release-notes
59+
run: |
60+
# Extract version from tag
61+
VERSION=${GITHUB_REF#refs/tags/v}
62+
echo "version=$VERSION" >> $GITHUB_OUTPUT
63+
64+
# Create release notes (customize as needed)
65+
echo "## Changes in v$VERSION" > release_notes.md
66+
echo "" >> release_notes.md
67+
echo "See full changelog in the repository." >> release_notes.md
68+
69+
- name: Create GitHub Release
70+
uses: softprops/action-gh-release@v1
71+
with:
72+
files: |
73+
dist/*.whl
74+
dist/*.tar.gz
75+
body_path: release_notes.md
76+
draft: false
77+
prerelease: false
78+
token: ${{ secrets.PAT_TOKEN }}
79+
80+
# - name: Publish to PyPI
81+
# env:
82+
# POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
83+
# run: poetry publish
84+
85+
- name: Trigger Zenodo
86+
if: success()
87+
run: |
88+
echo "Release v${{ steps.extract-release-notes.outputs.version }} published successfully!"
89+
echo "Zenodo DOI will be generated automatically if connected."

0 commit comments

Comments
 (0)