-
Notifications
You must be signed in to change notification settings - Fork 69
103 lines (93 loc) · 2.67 KB
/
release.yml
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
name: Release
on:
push:
jobs:
build:
name: Build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
check-tag:
name: Check tag
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
outputs:
is_final: ${{ steps.check.outputs.is_final }}
steps:
- name: Check if tag is a pre-release
id: check
run: |
echo "is_final=$(echo '${{ github.ref }}' | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
provenance:
name: Provenance
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write # Needed for attestations
attestations: write # Needed for attestations
outputs:
bundle-path: ${{ steps.attest.outputs.bundle-path }}
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- uses: actions/attest-build-provenance@v1
id: attest
with:
subject-path: "./dist/singer_sdk*"
- uses: actions/upload-artifact@v4
with:
name: Attestations
path: ${{ steps.attest.outputs.bundle-path }}
publish:
name: PyPI
runs-on: ubuntu-latest
needs: [build]
environment:
name: publishing
url: https://pypi.org/p/singer-sdk
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write # Needed for OIDC PyPI publishing
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.11.0
upload-to-release:
name: Upload files to release
runs-on: ubuntu-latest
needs: [build, check-tag, provenance]
if: ${{ startsWith(github.ref, 'refs/tags/') && needs.check-tag.outputs.is_final == 'true' }}
permissions:
contents: write # Needed for uploading files to the release
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- uses: actions/download-artifact@v4
with:
name: Attestations
path: attestations
- name: Upload wheel and sdist to release
uses: svenstaro/upload-release-action@v2
with:
file: dist/singer_sdk*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload attestations to release
uses: svenstaro/upload-release-action@v2
with:
file: attestations/attestation.jsonl
tag: ${{ github.ref }}
overwrite: true
asset_name: attestations.intoto.jsonl