-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (95 loc) · 2.76 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: release
on: # yamllint disable-line rule:truthy
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
jobs:
dist:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set SOURCE_DATE_EPOCH
run: |
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
echo SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH >> $GITHUB_ENV
echo $(git log -1 --pretty=%ci) [timestamp=$SOURCE_DATE_EPOCH]
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3
- name: Upgrade pip
run: python -m pip install -U pip
- name: Install build and twine
run: python -m pip install -U build twine
- name: Build source distribution
run: python -m build --sdist
- name: Check source distribution
run: python -m twine check dist/*.tar.gz
- name: Compute SHA256 checksum
run: sha256sum -b *.tar.gz >> sha256sum.txt
working-directory: dist
- name: Report SHA256 checksum
run: |
echo '```' >> $GITHUB_STEP_SUMMARY
cat sha256sum.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
working-directory: dist
- name: Upload distribution artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist/*.tar.gz
dist/sha256sum.txt
- if: ${{ github.event_name == 'release' }}
name: Attest distribution artifact
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/*.tar.gz
gh-publish:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: dist
environment:
name: gh
url: https://github.com/mpi4py/shmem4py/releases
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download distribution artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package distributions to GitHub Releases
run: gh release upload $TAG dist/*.tar.gz
env:
TAG: ${{ github.event.release.tag_name }}
GITHUB_TOKEN: ${{ github.token }}
pypi-publish:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: dist
environment:
name: pypi
url: https://pypi.org/p/shmem4py/
permissions:
id-token: write
steps:
- name: Download distribution artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1