Skip to content

Fix ptex being included in all scies. (#124) #32

Fix ptex being included in all scies. (#124)

Fix ptex being included in all scies. (#124) #32

Workflow file for this run

name: Release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
workflow_dispatch:
inputs:
tag:
description: The tag to manually run a deploy for.
required: true
defaults:
run:
shell: bash
jobs:
org-check:
name: Check GitHub Organization
if: ${{ github.repository_owner == 'a-scie' }}
runs-on: ubuntu-22.04
steps:
- name: Noop
run: "true"
determine-tag:
name: Determine the release tag to operate against.
needs: org-check
runs-on: ubuntu-22.04
outputs:
release-tag: ${{ steps.determine-tag.outputs.release-tag }}
release-version: ${{ steps.determine-tag.outputs.release-version }}
steps:
- name: Determine Tag
id: determine-tag
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
RELEASE_TAG=${{ github.event.inputs.tag }}
else
RELEASE_TAG=${GITHUB_REF#refs/tags/}
fi
if [[ "${RELEASE_TAG}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "release-tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
echo "release-version=${RELEASE_TAG#v}" >> $GITHUB_OUTPUT
else
echo "::error::Release tag '${RELEASE_TAG}' must match 'v\d+.\d+.\d+'."
exit 1
fi
github-release:
name: (${{ matrix.name }}) Create Github Release
needs: determine-tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
# N.B.: macos-13 is the oldest non-deprecated Intel Mac runner and macos-14 is the oldest
# non-deprecated ARM Mac runner.
include:
- os: ubuntu-24.04
name: Linux x86-64
docker-platform: linux/amd64
- os: ubuntu-24.04
name: Linux aarch64
docker-platform: linux/arm64
- os: ubuntu-24.04
name: Linux armv7l
docker-platform: linux/arm/v7
- os: ubuntu-24.04
name: Linux s390x
docker-platform: linux/s390x
- os: ubuntu-24.04
name: Linux powerpc64le
docker-platform: linux/ppc64le
- os: macos-13
name: macOS x86-64
- os: macos-14
name: macOS aarch64
- os: windows-2022
name: Windows x86-64
- os: windows-arm64
name: Windows aarch64
environment: Release
env:
FORCE_COLOR: 1
SCIENCE_AUTH_API_GITHUB_COM_BEARER: ${{ secrets.GITHUB_TOKEN }}
permissions:
id-token: write
attestations: write
contents: write
discussions: write
steps:
- name: Install the latest version of uv
if: matrix.docker-platform == '' && matrix.os != 'windows-arm64'
uses: astral-sh/setup-uv@v4
- name: Install the latest version of uv
if: matrix.os == 'windows-arm64'
shell: cmd
run: |
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
cargo install --git https://github.com/astral-sh/uv uv
uv -V
- name: Setup x86_64 Python for Prism
if: matrix.os == 'windows-arm64'
run: |
# N.B.: We use an x86-64 Python for Windows ARM64 because this is what we ship with via
# PBS, and we need to be able to resolve x86-64 compatible requirements (which include
# native deps like psutil) for our shiv.
UV_PYTHON_VERSION=cpython-3.12.8-windows-x86_64-none
uv python install ${UV_PYTHON_VERSION}
echo UV_PYTHON_ARGS="--python ${UV_PYTHON_VERSION}" >> ${GITHUB_ENV}
- name: Installing emulators
if: matrix.docker-platform != ''
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: Checkout lift ${{ needs.determine-tag.outputs.release-tag }}
uses: actions/checkout@v4
with:
ref: ${{ needs.determine-tag.outputs.release-tag }}
- name: Package science ${{ needs.determine-tag.outputs.release-tag }} binary
if: matrix.docker-platform == ''
run: uv run ${UV_PYTHON_ARGS} dev-cmd package
- name: Package science ${{ needs.determine-tag.outputs.release-tag }} binary
if: matrix.docker-platform != ''
run: |
docker run --rm \
-e FORCE_COLOR \
-e SCIENCE_AUTH_API_GITHUB_COM_BEARER \
-v $PWD:/code \
-w /code \
--platform ${{ matrix.docker-platform }} \
python:3.12-bookworm \
bash -c "
pip install --root-user-action ignore uv &&
addgroup --gid $(id -g) build &&
adduser --disabled-password --gecos '' --gid $(id -g) --uid $(id -u) build &&
su build -c 'uv run dev-cmd package'
"
- name: Generate science ${{ needs.determine-tag.outputs.release-tag }} artifact attestations
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/science-*
- name: Prepare Changelog
id: prepare-changelog
uses: a-scie/actions/[email protected]
with:
changelog-file: ${{ github.workspace }}/CHANGES.md
version: ${{ needs.determine-tag.outputs.release-version }}
setup-python: ${{ matrix.os != 'windows-arm64' }}
- name: Create ${{ needs.determine-tag.outputs.release-tag }} Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.determine-tag.outputs.release-tag }}
name: science ${{ needs.determine-tag.outputs.release-version }}
body_path: ${{ steps.prepare-changelog.outputs.changelog-file }}
draft: false
prerelease: false
files: dist/science-*
fail_on_unmatched_files: true
discussion_category_name: Announcements