-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (62 loc) · 1.93 KB
/
semantic-release.yaml
File metadata and controls
70 lines (62 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Semantic Release
on:
push:
branches:
- main
jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yaml
tests:
uses: ./.github/workflows/tests.yaml
release:
name: Release
needs: [pre-commit, tests]
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
with:
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Force release branch to workflow SHA
run: git reset --hard ${{ github.sha }}
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install uv and sync dev dependencies
run: |
pip install uv
uv venv
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv sync --dev
- name: Python Semantic Release
id: release
env:
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
run: |
output=$(semantic-release -v version 2>&1)
status=$?
echo "$output"
if echo "$output" | grep -q "The next version is"; then
echo "released=true" >> $GITHUB_OUTPUT
else
echo "released=false" >> $GITHUB_OUTPUT
fi
exit $status
- name: Publish package distributions to PyPI
if: steps.release.outputs.released == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish package distributions to GitHub Releases
if: steps.release.outputs.released == 'true'
uses: python-semantic-release/publish-action@v10.5.3
with:
github_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}