-
Notifications
You must be signed in to change notification settings - Fork 46
73 lines (73 loc) · 2.62 KB
/
Copy pathrelease.yml
File metadata and controls
73 lines (73 loc) · 2.62 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
# Build, publish to PyPI, and attach artifacts when a GitHub Release is published.
# Assumes CI has already passed on `main`; this workflow does not re-run tests.
name: Release
on:
release:
types: [published]
# Never cancel an in-flight release.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
# Default to read-only; each job opts into the extra scope it needs.
permissions:
contents: read
jobs:
build:
name: "Build distribution"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/nix-shell
with:
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Verify git tag matches pyproject.toml version
run: |
PROJECT_VERSION=$(nix-shell --run "uv version --short")
echo "tag=$GITHUB_REF_NAME project=$PROJECT_VERSION"
[[ "$GITHUB_REF_NAME" == "$PROJECT_VERSION" ]] && exit 0 || exit 1
- name: Build sdist and wheel
run: nix-shell --run "uv build"
- name: Upload distribution artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: dist/
if-no-files-found: error
publish:
name: "Publish to PyPI"
needs: [build]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyramid_openapi3
permissions:
id-token: write # Trusted publishing uses OIDC token to mint short-lived PyPI API token
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: dist/
- name: Publish to PyPI via trusted publishing
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
github-release:
name: "Attach artifacts to release"
needs: [publish]
runs-on: ubuntu-latest
permissions:
contents: write # Needed to create release and upload assets
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Download distribution artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: dist/
- name: Upload artifacts to the release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" dist/* --clobber