Build and publish release artifacts workflow (vtuber-plan/olah)
The Build and publish release artifacts workflow from vtuber-plan/olah, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Build and publish release artifacts workflow from the vtuber-plan/olah repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Build and publish release artifacts
run-name: Build and publish release artifacts for ${{ github.ref_name }}
on:
push:
tags:
- "v*"
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-release:
name: Build wheel and publish GitHub release
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Apache Arrow
run: |
sudo apt update
sudo apt install -y -V ca-certificates lsb-release wget
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt update
sudo apt install -y -V libarrow-dev libarrow-glib-dev libparquet-dev libparquet-glib-dev
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build dependencies
run: |
pip install --upgrade pip
pip install -e .
pip install -r requirements.txt
pip install build twine
- name: Validate tag matches package version
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PACKAGE_VERSION="$(python -c "from pathlib import Path; import tomllib; print(tomllib.loads(Path('pyproject.toml').read_text())['project']['version'])")"
if [[ "${TAG_VERSION}" != "${PACKAGE_VERSION}" ]]; then
echo "Tag version ${TAG_VERSION} does not match pyproject version ${PACKAGE_VERSION}" >&2
exit 1
fi
- name: Test Olah
run: python -m pytest tests
- name: Build Olah
run: python -m build
- name: Check build artifacts
run: python -m twine check dist/*
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true
prerelease: false
files: |
dist/*.tar.gz
dist/*.whl
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: Build and publish release artifacts run-name: Build and publish release artifacts for ${{ github.ref_name }} on: push: tags: - "v*" permissions: contents: write concurrency: group: release-${{ github.ref }} cancel-in-progress: false jobs: build-and-release: timeout-minutes: 30 name: Build wheel and publish GitHub release runs-on: latchkey-small steps: - name: Check out repository code uses: actions/checkout@v4 - name: Set up Apache Arrow run: | sudo apt update sudo apt install -y -V ca-certificates lsb-release wget wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb sudo apt update sudo apt install -y -V libarrow-dev libarrow-glib-dev libparquet-dev libparquet-glib-dev - name: Set up Python uses: actions/setup-python@v5 with: cache: 'pip' python-version: "3.12" - name: Install build dependencies run: | pip install --upgrade pip pip install -e . pip install -r requirements.txt pip install build twine - name: Validate tag matches package version run: | TAG_VERSION="${GITHUB_REF_NAME#v}" PACKAGE_VERSION="$(python -c "from pathlib import Path; import tomllib; print(tomllib.loads(Path('pyproject.toml').read_text())['project']['version'])")" if [[ "${TAG_VERSION}" != "${PACKAGE_VERSION}" ]]; then echo "Tag version ${TAG_VERSION} does not match pyproject version ${PACKAGE_VERSION}" >&2 exit 1 fi - name: Test Olah run: python -m pytest tests - name: Build Olah run: python -m build - name: Check build artifacts run: python -m twine check dist/* - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - name: Publish GitHub release uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} generate_release_notes: true prerelease: false files: | dist/*.tar.gz dist/*.whl
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
- Network fetches
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.