-
Notifications
You must be signed in to change notification settings - Fork 33
81 lines (71 loc) · 2.39 KB
/
build-and-publish-package.yaml
File metadata and controls
81 lines (71 loc) · 2.39 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
name: Build and publish package
permissions:
contents: read
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
name: Build LNT package
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0 # fetch all history including tags -- necessary to determine the version from SCM
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: "3.10"
# We only build a source distribution because binary distributions for Linux can't be uploaded
# to PyPI. Our source distribution is trivial to build anyway.
- name: Build the source tarball
run: |
python -m pip install build
python -m build --sdist
- name: Store the distribution packages
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # only publish to TestPyPI on tag pushes
name: Publish LNT to TestPyPI
needs: [build]
environment:
name: testpypi
url: https://test.pypi.org/p/llvm-lnt
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: python-package-distributions
path: dist/
- name: Publish LNT to TestPyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
publish-to-pypi:
runs-on: ubuntu-latest
name: Publish LNT to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/llvm-lnt
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: python-package-distributions
path: dist/
- name: Publish LNT to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
verbose: true