Skip to content

Merge pull request #152 from boomanaiden154/hash-pin-github-actions-1… #155

Merge pull request #152 from boomanaiden154/hash-pin-github-actions-1…

Merge pull request #152 from boomanaiden154/hash-pin-github-actions-1… #155

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