Skip to content

Tweak release workflow to build wheel from sdist in the job that prod… #11

Tweak release workflow to build wheel from sdist in the job that prod…

Tweak release workflow to build wheel from sdist in the job that prod… #11

Workflow file for this run

name: Release
on:
push:
branches:
- 'feat/build-wheels-from-sdist'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Only run for full release tags
jobs:
download_archives:
uses: ./.github/workflows/web_artifact.yaml
with:
name: 6s-archives
urls: |
[
"https://web.archive.org/web/20220912090811if_/https://rtwilson.com/downloads/6SV-1.1.tar",
"https://web.archive.org/web/20220909154857if_/https://salsa.umd.edu/files/6S/6sV2.1.tar"
]
retention-days: 1
build:
needs: download_archives
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ "windows-latest", "ubuntu-latest", "macos-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
include:
- os: ubuntu-latest
python-version: '3.11'
sdist: true
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Fortran
uses: awvwgk/setup-fortran@v1
- name: Install build frontend
run: python -m pip install --upgrade pip build
- name: Retrieve 6S source archives
uses: actions/download-artifact@v3
with:
name: 6s-archives
path: 6s-archives
# Only build source distribution in a single job.
# In the job that builds the source distribution, call 'build' with no arguments so that it builds the wheel
# from the sdist. In all other jobs, the wheel is built directly from the source directory.
# This way, we confirm that wheels can be successfully built from the sdist.
- name: Build wheel ${{ matrix.sdist && "and sdist" }}

Check failure on line 60 in .github/workflows/release.yaml

View workflow run for this annotation

GitHub Actions / Release

Invalid workflow file

The workflow is not valid. .github/workflows/release.yaml (Line: 60, Col: 15): Unexpected symbol: '"and'. Located at position 17 within expression: matrix.sdist && "and sdist" .github/workflows/release.yaml (Line: 61, Col: 14): Unexpected symbol: '"--wheel"'. Located at position 18 within expression: !matrix.sdist && "--wheel"
run: python -I -m build ${{ !matrix.sdist && "--wheel" }}
env:
SIXS_ARCHIVE_DIR: 6s-archives
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: 5
if-no-files-found: error
publish:
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Retrieve distributions
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/