Skip to content

Commit 894eacc

Browse files
authored
Merge pull request #256 from andyfaff/pub
Trusted publishing work
2 parents 2314979 + d96afc1 commit 894eacc

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

.github/workflows/posix.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
workflow_dispatch: null
1111
schedule:
1212
- cron: '0 0 * * 0'
13+
workflow_call:
14+
1315

1416
jobs:
1517
build:

.github/workflows/publish.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Publish scipy_openblasN wheels
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: Which PyPI environment to upload to, if any
8+
required: true
9+
type: choice
10+
options: [ "none", "testpypi", "pypi" ]
11+
12+
13+
permissions:
14+
contents: read # to fetch code (actions/checkout)
15+
16+
17+
jobs:
18+
# -------------------------------------------------------------------------------------
19+
# Workflows to build wheels
20+
call-posix:
21+
uses: ./.github/workflows/posix.yml
22+
23+
24+
call-windows:
25+
uses: ./.github/workflows/windows.yml
26+
27+
28+
call-windows-arm:
29+
uses: ./.github/workflows/windows-arm.yml
30+
31+
32+
# -------------------------------------------------------------------------------------
33+
check-version:
34+
name: Ensure commit is tag before upload to PyPi
35+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout openblas-libs
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
41+
with:
42+
fetch-depth: 0
43+
fetch-tags: true
44+
submodules: true
45+
persist-credentials: false
46+
47+
- name: Examine git commit
48+
run: |
49+
if [ -n "$(git tag --points-at HEAD)" ]; then
50+
echo "Current HEAD is tagged."
51+
else
52+
echo "Current HEAD is not tagged."
53+
exit 1
54+
fi
55+
56+
57+
# -------------------------------------------------------------------------------------
58+
testpypi-publish32:
59+
name: Publish scipy-openblas32 to TestPyPI
60+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
61+
needs: [call-posix, call-windows, call-windows-arm]
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: testpypi
65+
url: https://test.pypi.org/project/scipy-openblas32/
66+
permissions:
67+
id-token: write # mandatory for trusted publishing
68+
steps:
69+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
70+
with:
71+
# I think the run-id for call-posix, call-windows, call-windows-arm should all be the same
72+
run-id: ${{ needs.call-posix.outputs.run_id }}
73+
pattern: wheels-*
74+
merge-multiple: true
75+
path: dist
76+
77+
- name: Publish
78+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
79+
with:
80+
repository-url: https://test.pypi.org/legacy/
81+
skip-existing: true
82+
print-hash: true
83+
attestations: true
84+
85+
86+
testpypi-publish64:
87+
name: Publish scipy-openblas64 to TestPyPI
88+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
89+
needs: [call-posix, call-windows, call-windows-arm]
90+
runs-on: ubuntu-latest
91+
environment:
92+
name: testpypi
93+
url: https://test.pypi.org/project/scipy-openblas64/
94+
permissions:
95+
id-token: write # mandatory for trusted publishing
96+
steps:
97+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
98+
with:
99+
# I think the run-id for call-posix, call-windows, call-windows-arm should all be the same
100+
run-id: ${{ needs.call-posix.outputs.run_id }}
101+
pattern: wheels-*
102+
merge-multiple: true
103+
path: dist
104+
105+
- name: Publish
106+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
107+
with:
108+
repository-url: https://test.pypi.org/legacy/
109+
skip-existing: true
110+
print-hash: true
111+
attestations: true
112+
113+
## -------------------------------------------------------------------------------------
114+
# pypi-publish:
115+
# name: Publish release to PyPI
116+
# if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
117+
# needs: [call-posix, call-windows, call-windows-arm, check-version]
118+
# runs-on: ubuntu-latest
119+
# environment:
120+
# name: pypi
121+
# url: https://pypi.org/p/scipy_openblas-32
122+
# permissions:
123+
# id-token: write # mandatory for trusted publishing
124+
# steps:
125+
# - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
126+
# with:
127+
# run-id: ${{ needs.call-posix.outputs.run_id }}
128+
# pattern: wheels-*
129+
# merge-multiple: true
130+
# path: dist
131+
#
132+
# - name: Publish
133+
# uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
134+
# with:
135+
# print-hash: true
136+
# attestations: true

.github/workflows/windows-arm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
branches:
88
- main
99
- maintenance/**
10+
workflow_call:
11+
1012

1113
env:
1214
OPENBLAS_ROOT: "c:\\opt"

.github/workflows/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- main
99
- maintenance/**
1010
workflow_dispatch: null
11+
workflow_call:
1112

1213
env:
1314
OPENBLAS_ROOT: "c:\\opt"

0 commit comments

Comments
 (0)