-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (75 loc) · 2.33 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (75 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
name: Release
# Conforms to the umbrella SDK release pipeline contract:
# u5c-factory reference/sdk-pipeline.md
on:
push:
tags: ['v*']
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify tag matches package version
run: |
TAG="${GITHUB_REF_NAME#v}"
MANIFEST=$(sed -nE 's/^version = "(.+)"/\1/p' pyproject.toml | head -1)
if [ "$TAG" != "$MANIFEST" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match pyproject.toml version $MANIFEST"
exit 1
fi
build:
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry
# Relock first: poetry.lock is stale vs pyproject.toml (see ci.yml).
- run: poetry lock
- run: poetry install
- run: poetry build
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry
- run: poetry lock
- run: poetry install
# No pytest suite yet; import-smoke the package (see ci.yml).
- run: poetry run python -c "import utxorpc"
publish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry
- name: Publish to PyPI
env:
PYPI_REGISTRY_TOKEN: ${{ secrets.PYPI_REGISTRY_TOKEN }}
run: poetry publish --build --username __token__ --password "$PYPI_REGISTRY_TOKEN"
# Publishing the package and announcing it are separate concerns: this job is
# kept apart from `publish` so the credential-bearing job keeps `contents: read`.
release:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
# A SemVer pre-release suffix is the only place a hyphen appears in the tag.
prerelease: ${{ contains(github.ref_name, '-') }}