Repository navigation
85 lines (78 loc) · 2.33 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (78 loc) · 2.33 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Release on a version tag: test, build, publish to PyPI, then create the
# GitHub release with the same files. Push an annotated tag whose name is
# "v" + asmdiff.__version__ (git tag -a v0.4.1; git push origin v0.4.1);
# the tag message becomes the release notes.
#
# PyPI side, once: the project's Publishing settings carry a trusted
# publisher for owner rt-rtos, repository asmdiff, workflow release.yml,
# environment release. No token is stored anywhere.
name: release
on:
push:
tags: ["v*"]
permissions:
contents: read
jobs:
test:
strategy:
matrix:
include:
- { os: ubuntu-22.04, python: "3.8" } # requires-python floor
- { os: ubuntu-latest, python: "3.13" } # tomllib paths
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python test_asmdiff.py
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Tag matches __version__
run: |
v=$(python -c 'import asmdiff; print(asmdiff.__version__)')
if [ "v$v" != "$GITHUB_REF_NAME" ]; then
echo "tag $GITHUB_REF_NAME does not match __version__ $v" >&2
exit 1
fi
- run: python -m pip install build
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
pypi:
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
github-release:
needs: pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
git fetch --force origin "refs/tags/$GITHUB_REF_NAME:refs/tags/$GITHUB_REF_NAME"
gh release create "$GITHUB_REF_NAME" dist/* --verify-tag --notes-from-tag