release-assets workflow (baileyh8/hermes-feishu-streaming-card)
The release-assets workflow from baileyh8/hermes-feishu-streaming-card, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the release-assets workflow from the baileyh8/hermes-feishu-streaming-card 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: release-assets
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Release tag to package"
required: true
type: string
permissions:
contents: write
jobs:
package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Select workflow_dispatch tag
if: github.event_name == 'workflow_dispatch'
run: git checkout "${{ inputs.tag }}"
- name: Build install packages
shell: bash
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
fi
NAME="hermes-feishu-card-${TAG}"
mkdir -p dist pkg/macos pkg/linux pkg/windows
COMMON_FILES=(
README-install.md
config.yaml.example
README.md
README.en.md
CHANGELOG.md
LICENSE
)
cp install.sh install-docker.sh docker-compose.example.yml "${COMMON_FILES[@]}" pkg/macos/
cp install.sh install-docker.sh docker-compose.example.yml "${COMMON_FILES[@]}" pkg/linux/
cp install.ps1 install-docker.sh docker-compose.example.yml "${COMMON_FILES[@]}" pkg/windows/
(cd pkg/macos && tar -czf "../../dist/${NAME}-macos.tar.gz" .)
(cd pkg/linux && tar -czf "../../dist/${NAME}-linux.tar.gz" .)
(cd pkg/windows && zip -qr "../../dist/${NAME}-windows.zip" .)
(cd dist && shasum -a 256 * > "${NAME}-checksums.txt")
- name: Upload release assets
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
fi
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" dist/* --clobber
else
gh release create "$TAG" dist/* --title "$TAG" --generate-notes
fi
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: release-assets on: push: tags: - "v*" workflow_dispatch: inputs: tag: description: "Release tag to package" required: true type: string permissions: contents: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: package: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Select workflow_dispatch tag if: github.event_name == 'workflow_dispatch' run: git checkout "${{ inputs.tag }}" - name: Build install packages shell: bash run: | set -euo pipefail TAG="${GITHUB_REF_NAME}" if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then TAG="${{ inputs.tag }}" fi NAME="hermes-feishu-card-${TAG}" mkdir -p dist pkg/macos pkg/linux pkg/windows COMMON_FILES=( README-install.md config.yaml.example README.md README.en.md CHANGELOG.md LICENSE ) cp install.sh install-docker.sh docker-compose.example.yml "${COMMON_FILES[@]}" pkg/macos/ cp install.sh install-docker.sh docker-compose.example.yml "${COMMON_FILES[@]}" pkg/linux/ cp install.ps1 install-docker.sh docker-compose.example.yml "${COMMON_FILES[@]}" pkg/windows/ (cd pkg/macos && tar -czf "../../dist/${NAME}-macos.tar.gz" .) (cd pkg/linux && tar -czf "../../dist/${NAME}-linux.tar.gz" .) (cd pkg/windows && zip -qr "../../dist/${NAME}-windows.zip" .) (cd dist && shasum -a 256 * > "${NAME}-checksums.txt") - name: Upload release assets env: GH_TOKEN: ${{ github.token }} shell: bash run: | set -euo pipefail TAG="${GITHUB_REF_NAME}" if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then TAG="${{ inputs.tag }}" fi if gh release view "$TAG" >/dev/null 2>&1; then gh release upload "$TAG" dist/* --clobber else gh release create "$TAG" dist/* --title "$TAG" --generate-notes fi
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. - 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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.