DB Release workflow (horsicq/Detect-It-Easy)
The DB Release workflow from horsicq/Detect-It-Easy, explained and optimized by Latchkey.
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.
What it does
This is the DB Release workflow from the horsicq/Detect-It-Easy 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: DB Release
on:
push:
branches: ["master"]
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Clone Detect-It-Easy
run: |
git clone https://github.com/horsicq/Detect-It-Easy DIE
- name: Release db
if: ${{ hashFiles('DIE/db/info.ini') != '' }}
run: |
cd DIE
zip -r ../db.zip db
cd ..
- name: Read db/info.ini
if: ${{ hashFiles('DIE/db/info.ini') != '' }}
id: db_info
run: |
DB_INFO=$(cat DIE/db/info.ini)
echo "DB_INFO<<EOF" >> $GITHUB_OUTPUT
echo "$DB_INFO" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Update db release
if: ${{ hashFiles('DIE/db/info.ini') != '' }}
uses: softprops/action-gh-release@v3
with:
files: db.zip
name: "db"
tag_name: db
body: ${{ steps.db_info.outputs.DB_INFO }}
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Create db_extra.zip
if: ${{ hashFiles('DIE/db_extra/info.ini') != '' }}
run: |
cd DIE
zip -r ../db_extra.zip db_extra
cd ..
- name: Read db_extra/info.ini
if: ${{ hashFiles('DIE/db_extra/info.ini') != '' }}
id: db_extra_info
run: |
DB_EXTRA_INFO=$(cat DIE/db_extra/info.ini)
echo "DB_EXTRA_INFO<<EOF" >> $GITHUB_OUTPUT
echo "$DB_EXTRA_INFO" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Update db_extra release
if: ${{ hashFiles('DIE/db_extra/info.ini') != '' }}
uses: softprops/action-gh-release@v3
with:
files: db_extra.zip
name: "db_extra"
tag_name: db_extra
body: ${{ steps.db_extra_info.outputs.DB_EXTRA_INFO }}
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: DB Release on: push: branches: ["master"] workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: release: timeout-minutes: 30 runs-on: latchkey-small permissions: contents: write steps: - name: Clone Detect-It-Easy run: | git clone https://github.com/horsicq/Detect-It-Easy DIE - name: Release db if: ${{ hashFiles('DIE/db/info.ini') != '' }} run: | cd DIE zip -r ../db.zip db cd .. - name: Read db/info.ini if: ${{ hashFiles('DIE/db/info.ini') != '' }} id: db_info run: | DB_INFO=$(cat DIE/db/info.ini) echo "DB_INFO<<EOF" >> $GITHUB_OUTPUT echo "$DB_INFO" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Update db release if: ${{ hashFiles('DIE/db/info.ini') != '' }} uses: softprops/action-gh-release@v3 with: files: db.zip name: "db" tag_name: db body: ${{ steps.db_info.outputs.DB_INFO }} draft: false prerelease: true env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} - name: Create db_extra.zip if: ${{ hashFiles('DIE/db_extra/info.ini') != '' }} run: | cd DIE zip -r ../db_extra.zip db_extra cd .. - name: Read db_extra/info.ini if: ${{ hashFiles('DIE/db_extra/info.ini') != '' }} id: db_extra_info run: | DB_EXTRA_INFO=$(cat DIE/db_extra/info.ini) echo "DB_EXTRA_INFO<<EOF" >> $GITHUB_OUTPUT echo "$DB_EXTRA_INFO" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Update db_extra release if: ${{ hashFiles('DIE/db_extra/info.ini') != '' }} uses: softprops/action-gh-release@v3 with: files: db_extra.zip name: "db_extra" tag_name: db_extra body: ${{ steps.db_extra_info.outputs.DB_EXTRA_INFO }} draft: false prerelease: true env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
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.
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.