Repository navigation
66 lines (54 loc) · 2.15 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (54 loc) · 2.15 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
# Cuts a release with python-semantic-release. Run it from `staging` (our
# active branch): it reads the conventional commits since the last tag,
# computes the next version, updates the version, the lock file and the
# changelog, commits, tags and publishes a GitHub Release on `staging`. It then
# fast-forwards `master` and force-pushes `mef-latest` to that commit.
# rero-mef is not published to PyPI, so there is no publish step.
name: Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging'
concurrency: release
steps:
- name: Generate a token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
run: uv python install 3.14
- name: Python Semantic Release
id: release
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
uvx --from python-semantic-release@latest semantic-release version
# A release was made if HEAD now points exactly at a tag.
if git describe --exact-match HEAD 2>/dev/null; then
echo "released=true" >> "$GITHUB_OUTPUT"
else
echo "released=false" >> "$GITHUB_OUTPUT"
fi
- name: Fast-forward master and update mef-latest
if: steps.release.outputs.released == 'true'
run: |
git push origin HEAD:master
git push --force origin HEAD:mef-latest