ci: audit workflows with zizmor (#1262) #320
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pypi_upload | |
on: | |
release: | |
types: [published] | |
push: | |
branches: [main] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
uses: Instagram/LibCST/.github/workflows/build.yml@main | |
upload_release: | |
name: Upload wheels to pypi | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Download binary wheels | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: wheels-* | |
path: wheelhouse | |
merge-multiple: true | |
- uses: actions/setup-python@v5 | |
with: | |
cache: pip | |
cache-dependency-path: "pyproject.toml" | |
python-version: "3.10" | |
- name: Install hatch | |
run: pip install -U hatch | |
- name: Build a source tarball | |
env: | |
LIBCST_NO_LOCAL_SCHEME: 1 | |
run: >- | |
hatch run python -m | |
build | |
--sdist | |
--outdir ${{ steps.download.outputs.download-path }} | |
- name: Publish distribution 📦 to Test PyPI | |
if: github.event_name == 'push' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
packages-dir: ${{ steps.download.outputs.download-path }} | |
- name: Publish distribution 📦 to PyPI | |
if: github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ${{ steps.download.outputs.download-path }} |