Don't run pypi ci on pull requests #14
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 Release CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
- runner: ubuntu-latest | |
target: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Install wal | |
run: python -m pip install . | |
- name: Install dependencies | |
run: python -m pip install build virtualenv | |
- name: Install stdlib + modules | |
run: | | |
python -m walc wal/libs/std/std.wal | |
python -m walc wal/libs/std/module.wal | |
- name: Build | |
id: build_linux | |
run: python -m build --wheel | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.platform.target }} | |
path: dist/* | |
if-no-files-found: error | |
macos: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: macos-latest | |
target: x86_64 | |
- runner: macos-14 | |
target: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Install wal | |
run: python -m pip install . | |
- name: Install dependencies | |
run: python -m pip install build virtualenv | |
- name: Install stdlib + modules | |
run: | | |
python -m walc wal/libs/std/std.wal | |
python -m walc wal/libs/std/module.wal | |
- name: Build | |
id: build_macos | |
run: python -m build --wheel | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.platform.target }} | |
path: dist/* | |
if-no-files-found: error | |
sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
outputs: | |
SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Install wal | |
run: python -m pip install . | |
- name: Install dependencies | |
run: python -m pip install build virtualenv | |
- name: Install stdlib + modules | |
run: | | |
python -m walc wal/libs/std/std.wal | |
python -m walc wal/libs/std/module.wal | |
- name: Build sdist | |
id: build_sdist | |
run: python -m build --sdist | |
- name: Upload sdist result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist/* | |
if-no-files-found: error | |
release-test: | |
name: Test Release | |
runs-on: ubuntu-latest | |
if: "! startsWith(github.ref, 'refs/tags/')" | |
needs: [linux, macos, sdist] | |
permissions: | |
id-token: write | |
environment: pypitest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
- name: Publish to PyPITest | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
attestations: false | |
skip-existing: true | |
repository-url: https://test.pypi.org/legacy/ | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [linux, macos, sdist] | |
permissions: | |
id-token: write | |
environment: pypi | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
attestations: false | |
skip-existing: true |