Skip to content
Latchkey

Publish On Tag workflow (obgnail/typora_plugin)

The Publish On Tag workflow from obgnail/typora_plugin, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get 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: obgnail/typora_plugin.github/workflows/PublishOnTag.yamlLicense MITView source

What it does

This is the Publish On Tag workflow from the obgnail/typora_plugin 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 On Tag

on:
  push:
    tags:
      - '[0-9]+\.[0-9]+\.[0-9]+'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Get Latest Tag
        id: get_latest_tag
        run: |
          TAG=$(git describe --tags --abbrev=0)
          echo "tag=$TAG" >> $GITHUB_OUTPUT
          echo "Latest Tag: $TAG"

      - name: Package Plugin
        id: package_plugin
        run: |
          PLUGIN_NAME="typora-plugin"
          VERSION_JSON="plugin/bin/version.json"
          PLUGIN_VERSION="${{ steps.get_latest_tag.outputs.tag }}"
          ZIP_NAME="${PLUGIN_NAME}@v${PLUGIN_VERSION}.zip"
          PUBLISHED_AT=$(date -u +'%Y-%m-%dT%H:%M:%SZ')

          echo "Creating $VERSION_JSON"
          echo "{ \"tag_name\": \"${PLUGIN_VERSION}\", \"name\": \"${PLUGIN_VERSION}\", \"published_at\": \"${PUBLISHED_AT}\" }" > $VERSION_JSON

          echo "Creating zip archive: $ZIP_NAME"
          zip -r "$ZIP_NAME" plugin/
          echo "zip_name=$ZIP_NAME" >> $GITHUB_OUTPUT
          echo "Zip file created: $ZIP_NAME"

      - name: Create Release
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          files: ${{ steps.package_plugin.outputs.zip_name }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Publish On Tag
 
on:
  push:
    tags:
      - '[0-9]+\.[0-9]+\.[0-9]+'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
 
      - name: Get Latest Tag
        id: get_latest_tag
        run: |
          TAG=$(git describe --tags --abbrev=0)
          echo "tag=$TAG" >> $GITHUB_OUTPUT
          echo "Latest Tag: $TAG"
 
      - name: Package Plugin
        id: package_plugin
        run: |
          PLUGIN_NAME="typora-plugin"
          VERSION_JSON="plugin/bin/version.json"
          PLUGIN_VERSION="${{ steps.get_latest_tag.outputs.tag }}"
          ZIP_NAME="${PLUGIN_NAME}@v${PLUGIN_VERSION}.zip"
          PUBLISHED_AT=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
 
          echo "Creating $VERSION_JSON"
          echo "{ \"tag_name\": \"${PLUGIN_VERSION}\", \"name\": \"${PLUGIN_VERSION}\", \"published_at\": \"${PUBLISHED_AT}\" }" > $VERSION_JSON
 
          echo "Creating zip archive: $ZIP_NAME"
          zip -r "$ZIP_NAME" plugin/
          echo "zip_name=$ZIP_NAME" >> $GITHUB_OUTPUT
          echo "Zip file created: $ZIP_NAME"
 
      - name: Create Release
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          files: ${{ steps.package_plugin.outputs.zip_name }}
 

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.

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

Actions used in this workflow