Release workflow (Postcatlab/postcat)
The Release workflow from Postcatlab/postcat, explained and optimized by Latchkey.
C
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 Release workflow from the Postcatlab/postcat repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: Release
# github release event list: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
on:
release:
types: [published]
jobs:
release:
name: Qi niu published
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- name: Check out git repository
uses: actions/checkout@v3.0.0
- name: Install Node.js
uses: actions/setup-node@v3.0.0
with:
node-version: '16'
- name: Release for Linux
if: matrix.os == 'ubuntu-latest'
run: |
npm i -g qiniu@6.x
echo "${{ secrets.QINIU_ENV_JS }}" > ./scripts/qiniu_env.js
node scripts/publish.js
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: Release # github release event list: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release on: release: types: [published] jobs: release: timeout-minutes: 30 name: Qi niu published runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] steps: - name: Check out git repository uses: actions/checkout@v3.0.0 - name: Install Node.js uses: actions/setup-node@v3.0.0 with: cache: 'npm' node-version: '16' - name: Release for Linux if: matrix.os == 'ubuntu-latest' run: | npm i -g qiniu@6.x echo "${{ secrets.QINIU_ENV_JS }}" > ./scripts/qiniu_env.js node scripts/publish.js
What changed
- Cache dependency installs on the setup step so they are served from cache.
- 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.