matrix-publisher workflow (thevickypedia/Jarvis)
The matrix-publisher workflow from thevickypedia/Jarvis, explained and optimized by Latchkey.
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the matrix-publisher workflow from the thevickypedia/Jarvis 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: matrix-publisher
on:
push:
branches:
- master
paths:
- "**/__init__.py"
workflow_dispatch:
inputs:
dry_run:
type: choice
description: Dry run mode
required: true
options:
- "true"
- "false"
jobs:
pypi-publisher:
runs-on: thevickypedia-default
outputs:
version: ${{ steps.publish.outputs.version }}
dry_run: ${{ steps.dry-run.outputs.dry_run }}
strategy:
fail-fast: false
matrix:
project_name:
- jarvis-ironman
- jarvis-bot
- jarvis-nlp
- natural-language-ui
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set dry-run
id: dry-run
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "::notice title=DryRun::Setting dry run to ${{ inputs.dry_run }} for '${{ github.event_name }}' event"
echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_ENV
echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_OUTPUT
else
echo "::notice title=DryRun::Setting dry run to false for '${{ github.event_name }}' event"
echo "dry_run=false" >> $GITHUB_ENV
echo "dry_run=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: "Update metadata: ${{ matrix.project_name }}"
run: |
python -m pip install toml
python update-toml.py
shell: bash
env:
FILE_PATH: "pyproject.toml"
PROJECT_NAME: "${{ matrix.project_name }}"
- uses: thevickypedia/pypi-publisher@v5
id: publish
with:
dry-run: ${{ env.dry_run }}
token: ${{ secrets.PYPI_TOKEN }}
checkout: 'false'
release:
needs: pypi-publisher
if: needs.pypi-publisher.outputs.dry_run == 'false'
uses: ./.github/workflows/release.yml
with:
project_version: ${{ needs.pypi-publisher.outputs.version }}
secrets: inherit
release-notes:
needs:
- release
- pypi-publisher
if: needs.pypi-publisher.outputs.dry_run == 'false' && needs.release.outputs.release_exists == 'false'
uses: ./.github/workflows/release_notes.yml
with:
project_version: ${{ needs.pypi-publisher.outputs.version }}
secrets: inherit
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: matrix-publisher on: push: branches: - master paths: - "**/__init__.py" workflow_dispatch: inputs: dry_run: type: choice description: Dry run mode required: true options: - "true" - "false" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: pypi-publisher: timeout-minutes: 30 runs-on: thevickypedia-default outputs: version: ${{ steps.publish.outputs.version }} dry_run: ${{ steps.dry-run.outputs.dry_run }} strategy: fail-fast: false matrix: project_name: - jarvis-ironman - jarvis-bot - jarvis-nlp - natural-language-ui steps: - name: Checkout uses: actions/checkout@v5 - name: Set dry-run id: dry-run run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "::notice title=DryRun::Setting dry run to ${{ inputs.dry_run }} for '${{ github.event_name }}' event" echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_ENV echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_OUTPUT else echo "::notice title=DryRun::Setting dry run to false for '${{ github.event_name }}' event" echo "dry_run=false" >> $GITHUB_ENV echo "dry_run=false" >> $GITHUB_OUTPUT fi shell: bash - name: "Update metadata: ${{ matrix.project_name }}" run: | python -m pip install toml python update-toml.py shell: bash env: FILE_PATH: "pyproject.toml" PROJECT_NAME: "${{ matrix.project_name }}" - uses: thevickypedia/pypi-publisher@v5 id: publish with: dry-run: ${{ env.dry_run }} token: ${{ secrets.PYPI_TOKEN }} checkout: 'false' release: timeout-minutes: 30 needs: pypi-publisher if: needs.pypi-publisher.outputs.dry_run == 'false' uses: ./.github/workflows/release.yml with: project_version: ${{ needs.pypi-publisher.outputs.version }} secrets: inherit release-notes: timeout-minutes: 30 needs: - release - pypi-publisher if: needs.pypi-publisher.outputs.dry_run == 'false' && needs.release.outputs.release_exists == 'false' uses: ./.github/workflows/release_notes.yml with: project_version: ${{ needs.pypi-publisher.outputs.version }} secrets: inherit
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
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:
- Dependency installs
This workflow runs 3 jobs (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.