-
Notifications
You must be signed in to change notification settings - Fork 36
77 lines (68 loc) · 2.27 KB
/
pypi.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
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Publish to PyPi
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ released ]
jobs:
build:
uses: samsung/supplychainassurance/.github/workflows/[email protected]
with:
version: "3.11"
upload: ${{ 'release' == github.event_name }}
slsa_release:
needs: [ build ]
if: ${{ 'release' == github.event_name }}
permissions:
id-token: write
uses: samsung/supplychainassurance/.github/workflows/[email protected]
with:
hash: "${{ needs.build.outputs.hash }}"
artifact: "${{ needs.build.outputs.artifact }}"
build_cmd: "${{ needs.build.outputs.build_command }}"
secrets:
EXPECTED_REPOSITORY: "${{ secrets.EXPECTED_REPOSITORY }}"
ECODETOKEN: "${{ secrets.ECODE_TOKEN }}"
upload_asset:
needs: [ build, slsa_release ]
if: ${{ 'release' == github.event_name }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Upload Assets
uses: samsung/supplychainassurance/.github/actions/[email protected]
env:
GITHUBTOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
artifacts: ${{ needs.slsa_release.outputs.artifacts }}
deploy:
runs-on: ubuntu-latest
needs: [ build, slsa_release, upload_asset ]
steps:
- name: Download Artifacts
if: ${{ 'release' == github.event_name }}
id: download
uses: samsung/supplychainassurance/.github/actions/[email protected]
with:
hash: ${{ needs.build.outputs.hash }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish
if: ${{ 'release' == github.event_name }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
cd ${{ steps.download.outputs.outdir }}
twine upload ${{ needs.build.outputs.artifact }}