Skip to content

Commit 78353db

Browse files
authored
CI/CD: Add release workflow (#33)
* CI/CD: Add dependabot configuration file * CI/CD: Add release workflow
1 parent 41986de commit 78353db

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
- package-ecosystem: pip
8+
directory: /
9+
schedule:
10+
interval: weekly

.github/workflows/release.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: dist
2+
3+
on: # yamllint disable-line rule:truthy
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
14+
dist:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
id-token: write
19+
attestations: write
20+
21+
steps:
22+
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set SOURCE_DATE_EPOCH
27+
run: |
28+
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
29+
echo SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH >> $GITHUB_ENV
30+
echo $(git log -1 --pretty=%ci) [timestamp=$SOURCE_DATE_EPOCH]
31+
32+
- name: Setup Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: 3
36+
37+
- name: Upgrade pip
38+
run: python -m pip install -U pip
39+
40+
- name: Install build and twine
41+
run: python -m pip install -U build twine
42+
43+
- name: Build source distribution
44+
run: python -m build --sdist
45+
46+
- name: Check source distribution
47+
run: python -m twine check dist/*.tar.gz
48+
49+
- name: Compute SHA256 checksum
50+
run: sha256sum -b *.tar.gz >> sha256sum.txt
51+
working-directory: dist
52+
53+
- name: Report SHA256 checksum
54+
run: |
55+
echo '```' >> $GITHUB_STEP_SUMMARY
56+
cat sha256sum.txt >> $GITHUB_STEP_SUMMARY
57+
echo '```' >> $GITHUB_STEP_SUMMARY
58+
working-directory: dist
59+
60+
- name: Upload distribution artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: dist
64+
path: |
65+
dist/*.tar.gz
66+
dist/sha256sum.txt
67+
68+
- if: ${{ github.event_name == 'release' }}
69+
name: Attest distribution artifact
70+
uses: actions/attest-build-provenance@v1
71+
with:
72+
subject-path: dist/*.tar.gz
73+
74+
gh-publish:
75+
if: ${{ github.event_name == 'release' }}
76+
runs-on: ubuntu-latest
77+
needs: dist
78+
environment:
79+
name: gh
80+
url: https://github.com/mpi4py/shmem4py/releases
81+
permissions:
82+
contents: write
83+
84+
steps:
85+
86+
- name: Checkout
87+
uses: actions/checkout@v4
88+
89+
- name: Download distribution artifact
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: dist
93+
path: dist
94+
95+
- name: Publish package distributions to GitHub Releases
96+
run: gh release upload $TAG dist/*.tar.gz
97+
env:
98+
TAG: ${{ github.event.release.tag_name }}
99+
GITHUB_TOKEN: ${{ github.token }}
100+
101+
pypi-publish:
102+
if: ${{ github.event_name == 'release' }}
103+
runs-on: ubuntu-latest
104+
needs: dist
105+
environment:
106+
name: pypi
107+
url: https://pypi.org/p/shmem4py/
108+
permissions:
109+
id-token: write
110+
111+
steps:
112+
113+
- name: Download distribution artifact
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: dist
117+
path: dist
118+
119+
- name: Publish package distributions to PyPI
120+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)