Repository navigation
107 lines (98 loc) · 3.4 KB
/
Copy pathpublish.yml
File metadata and controls
107 lines (98 loc) · 3.4 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Publish SDK
on:
release:
types: [published]
permissions:
contents: read
concurrency:
group: publish-sdk
cancel-in-progress: false
# Retain pending runs for versions that already have a GitHub release.
queue: max
defaults:
run:
shell: bash
jobs:
validate:
if: github.event.release.prerelease == false
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Validate release tag and ancestry
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
git merge-base --is-ancestor HEAD origin/main
[[ "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]
test "$(git rev-parse HEAD)" = "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")"
test "$RELEASE_TAG" = "v$(jq -er '.["."]' .release-please-manifest.json)"
check:
needs: validate
uses: ./.github/workflows/ci.yml
build:
needs: [validate, check]
runs-on: ubuntu-latest
timeout-minutes: 15
env:
# Only the hash-checked build task may build the project in this job.
UV_NO_SYNC: 'true'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.14'
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version: "0.12.17"
- run: uv sync --locked --no-install-project --no-build
- run: uv run --no-sync poe build
- name: Check package identity and release version
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: bash scripts/check_package.sh "${RELEASE_TAG#v}"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-package
path: dist/*
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: pypi
url: https://pypi.org/project/volcano-sdk-python/
permissions:
id-token: write
steps:
# Publishing receives checked artifacts without executing SDK source.
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: release-package
path: dist
- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
release-link:
needs: publish
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Link the published PyPI version in the release notes
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
notes="$(gh release view "$RELEASE_TAG" --json body --jq '.body')"
link="[View ${RELEASE_TAG} on PyPI](https://pypi.org/project/volcano-sdk-python/${RELEASE_TAG#v}/)"
if [[ "$notes" != *"$link"* ]]; then
printf '%s\n\n%s\n' "$notes" "$link" | gh release edit "$RELEASE_TAG" --notes-file -
fi