-
Notifications
You must be signed in to change notification settings - Fork 22
89 lines (86 loc) · 2.73 KB
/
Copy pathrelease.yml
File metadata and controls
89 lines (86 loc) · 2.73 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
name: Release and Publish
on:
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
permissions:
id-token: write
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: ${{ github.repository == 'substrait-io/substrait-python' }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Install build dependencies
run: |
python -m pip install build --user
- name: Build package
run: |
python -m build
- name: Upload package
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
retention-days: 1
github-release:
name: Attach assets to GitHub release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
# semantic-release creates the release for this tag in the same run that
# pushed the tag, normally seconds before this build finishes. Wait for it
# so the upload below attaches to that existing release (with its generated
# notes) instead of racing ahead and creating a bare release -- which would
# in turn make semantic-release's own release step fail with a 409.
- name: Wait for the semantic-release GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
for attempt in $(seq 1 30); do
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "Release $TAG found."
exit 0
fi
echo "Release $TAG not present yet (attempt $attempt/30); waiting 10s..."
sleep 10
done
echo "::error::Release $TAG did not appear within 5 minutes; not creating a bare release." >&2
exit 1
# Omitting `body` leaves the generated notes untouched (the action retains
# existing release info on update); only the wheel/sdist are attached.
- name: Attach artifacts to the GitHub release
uses: softprops/action-gh-release@v3
with:
files: |
./dist/*.whl
./dist/*.tar.gz
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build, github-release]
environment: pypi
steps:
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1