forked from nedbat/coveragepy
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (101 loc) · 3.23 KB
/
publish.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
name: "Publish"
on:
repository_dispatch:
# Triggered with `make` targets:
types:
- publish-testpypi # `make test_upload`
- publish-pypi # `make pypi_upload`
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
find-run:
name: "Find latest kit.yml run"
runs-on: "ubuntu-latest"
outputs:
run-id: ${{ steps.run-id.outputs.run-id }}
steps:
- name: "Find latest kit.yml run"
id: runs
uses: octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d # v2.3.1
with:
route: GET /repos/nedbat/coveragepy/actions/workflows/kit.yml/runs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Record run id"
id: run-id
run: |
echo "run-id=${{ fromJson(steps.runs.outputs.data).workflow_runs[0].id }}" >> "$GITHUB_OUTPUT"
publish-to-test-pypi:
name: "Publish to Test PyPI"
if: ${{ github.event.action == 'publish-testpypi' }}
permissions:
id-token: write
attestations: write
runs-on: "ubuntu-latest"
environment:
name: "testpypi"
needs:
- find-run
steps:
- name: "Download dists"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
repository: "nedbat/coveragepy"
run-id: ${{needs.find-run.outputs.run-id}}
github-token: ${{ secrets.GITHUB_TOKEN }}
pattern: "dist-*"
merge-multiple: true
path: "dist/"
- name: "What did we get?"
run: |
ls -alR
echo "Number of dists, should be 72:"
ls -1 dist | wc -l
- name: "Generate attestations"
uses: actions/attest-build-provenance@310b0a4a3b0b78ef57ecda988ee04b132db73ef8 # v1.4.1
with:
subject-path: "dist/*"
- name: "Publish dists to Test PyPI"
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
with:
repository-url: https://test.pypi.org/legacy/
publish-to-pypi:
name: "Publish to PyPI"
if: ${{ github.event.action == 'publish-pypi' }}
permissions:
id-token: write
attestations: write
runs-on: "ubuntu-latest"
environment:
name: "pypi"
needs:
- find-run
steps:
- name: "Download dists"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
repository: "nedbat/coveragepy"
run-id: ${{needs.find-run.outputs.run-id}}
github-token: ${{ secrets.GITHUB_TOKEN }}
pattern: "dist-*"
merge-multiple: true
path: "dist/"
- name: "What did we get?"
run: |
ls -alR
echo "Number of dists, should be 72:"
ls -1 dist | wc -l
- name: "Generate attestations"
uses: actions/attest-build-provenance@310b0a4a3b0b78ef57ecda988ee04b132db73ef8 # v1.4.1
with:
subject-path: "dist/*"
- name: "Publish dists to PyPI"
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0