Repository navigation
53 lines (48 loc) · 1.8 KB
/
Copy pathrelease.yml
File metadata and controls
53 lines (48 loc) · 1.8 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
name: Release
# Push a tag like v0.1.0 (or publish a GitHub Release). This gates on CI, builds the
# wheel + sdist, signs them, and attaches them to the release. VGI workers are not
# published to PyPI.
on:
push:
tags: ['v*.*.*']
workflow_dispatch:
permissions:
contents: read
jobs:
ci:
# In the template repositories a vX.Y.Z tag is a template version, not a worker
# release, so only a manual run builds there. Forks release on every tag.
if: ${{ github.event_name != 'push' || !startsWith(github.repository, 'Query-farm/vgi-starter-') }}
uses: ./.github/workflows/ci.yml
build:
needs: [ci]
runs-on: ubuntu-latest
permissions:
contents: write # create the release, attach assets
id-token: write # keyless signing + provenance
attestations: write
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- name: Check the tag matches pyproject.toml
if: startsWith(github.ref, 'refs/tags/')
run: ci/check-version.sh "${GITHUB_REF_NAME}"
- run: uv build --sdist --wheel --out-dir dist
- run: uvx twine check dist/*
- uses: sigstore/cosign-installer@v3
- name: Sign
run: for f in dist/*; do cosign sign-blob --yes --bundle "$f.cosign.bundle" "$f"; done
- uses: actions/attest-build-provenance@v2
with:
subject-path: dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Create the GitHub release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1 || gh release create "$GITHUB_REF_NAME" --generate-notes
gh release upload "$GITHUB_REF_NAME" dist/* --clobber