-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (79 loc) · 2.14 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (79 loc) · 2.14 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
name: Build and publish
on:
workflow_dispatch:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
branches:
- main
- 'stable/**'
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Build distribution
run: |
pipx run build --sdist
- name: Store the distribution packages
uses: actions/upload-artifact@v7
with:
name: pkg-sdist
path: dist/*.tar.gz
# PyPI is published before the GitHub release because a PyPI upload is
# irreversible (a version can be yanked, but the filename can never be
# reused), whereas a GitHub release can simply be deleted and recreated. If
# only one of the two succeeds, it should be the one that cannot be redone.
pypi:
name: Publish to pypi
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build_sdist
environment:
name: pypi
url: https://pypi.org/p/sbd-eigensolver
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: pkg-*
path: dist
merge-multiple: true
- name: Publish release to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github:
name: Publish to GitHub
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build_sdist
- pypi
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: pkg-*
path: dist
merge-multiple: true
- name: Generate checksums
working-directory: dist
run: sha256sum -- * > checksums.sha256
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--title '${{ github.ref_name }}'
--generate-notes
--verify-tag
dist/*