Skip to content
Latchkey

publish workflow (Ar9av/obsidian-wiki)

The publish workflow from Ar9av/obsidian-wiki, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: Ar9av/obsidian-wiki.github/workflows/publish.ymlLicense MITView source

What it does

This is the publish workflow from the Ar9av/obsidian-wiki 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

workflow (.yml)
name: publish

# Build and publish obsidian-wiki to PyPI when a version tag is pushed.
#
# Setup (one-time): on PyPI, add a Trusted Publisher for this repo with
# workflow `publish.yml` and environment `pypi`. No API token needed - the
# `id-token: write` permission below mints a short-lived OIDC credential.
#
# Release: bump `version` in pyproject.toml, commit, then
#   git tag v0.1.0 && git push origin v0.1.0

on:
  push:
    tags:
      - "v*"
  # Allow a manual build (artifacts only, no publish) for verification.
  workflow_dispatch:

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.x"
      - name: Build sdist and wheel
        run: |
          python -m pip install --upgrade build
          python -m build
      - name: Verify wheel bundles the skills
        run: |
          python -m pip install --upgrade twine
          twine check dist/*
          wheel=$(ls dist/*.whl)
          echo "Inspecting $wheel"
          if ! python -m zipfile -l "$wheel" | grep -q "obsidian_wiki/_data/skills/wiki-setup/SKILL.md"; then
            echo "::error::wheel is missing bundled skills under obsidian_wiki/_data/skills/"
            exit 1
          fi
      - uses: actions/upload-artifact@v4
        with:
          name: dist
          path: dist/

  publish:
    needs: build
    runs-on: ubuntu-latest
    # Only publish on a real tag push, not workflow_dispatch.
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
    environment: pypi
    permissions:
      id-token: write  # required for PyPI Trusted Publishing (OIDC)
      contents: write  # required for creating GitHub Releases
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist/
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          skip-existing: true
      - name: Create GitHub Release
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          gh release create "${{ github.ref_name }}" dist/* \
            --repo "${{ github.repository }}" \
            --title "${{ github.ref_name }}" \
            --generate-notes

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: publish
 
# Build and publish obsidian-wiki to PyPI when a version tag is pushed.
#
# Setup (one-time): on PyPI, add a Trusted Publisher for this repo with
# workflow `publish.yml` and environment `pypi`. No API token needed - the
# `id-token: write` permission below mints a short-lived OIDC credential.
#
# Release: bump `version` in pyproject.toml, commit, then
#   git tag v0.1.0 && git push origin v0.1.0
 
on:
  push:
    tags:
      - "v*"
  # Allow a manual build (artifacts only, no publish) for verification.
  workflow_dispatch:
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.x"
      - name: Build sdist and wheel
        run: |
          python -m pip install --upgrade build
          python -m build
      - name: Verify wheel bundles the skills
        run: |
          python -m pip install --upgrade twine
          twine check dist/*
          wheel=$(ls dist/*.whl)
          echo "Inspecting $wheel"
          if ! python -m zipfile -l "$wheel" | grep -q "obsidian_wiki/_data/skills/wiki-setup/SKILL.md"; then
            echo "::error::wheel is missing bundled skills under obsidian_wiki/_data/skills/"
            exit 1
          fi
      - uses: actions/upload-artifact@v4
        with:
          name: dist
          path: dist/
 
  publish:
    timeout-minutes: 30
    needs: build
    runs-on: latchkey-small
    # Only publish on a real tag push, not workflow_dispatch.
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
    environment: pypi
    permissions:
      id-token: write  # required for PyPI Trusted Publishing (OIDC)
      contents: write  # required for creating GitHub Releases
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist/
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          skip-existing: true
      - name: Create GitHub Release
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          gh release create "${{ github.ref_name }}" dist/* \
            --repo "${{ github.repository }}" \
            --title "${{ github.ref_name }}" \
            --generate-notes
 

What changed

1 third-party action is referenced by a movable tag. Pin it 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:

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow