Release for Edge workflow (violentmonkey/violentmonkey)
The Release for Edge workflow from violentmonkey/violentmonkey, explained and optimized by Latchkey.
CI health: F - at risk
Point runs-on at Latchkey and get caching, 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 Release for Edge workflow from the violentmonkey/violentmonkey 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 for Edge
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1 # v1 keeps tags
with:
fetch-depth: 250 # for `action-helper`
# persist-credentials: false # not implemented in v1
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version-file: 'package.json'
- name: Prepare
run: pnpm i && node scripts/action-helper.js
env:
ACTION_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
DISCORD_WEBHOOK_RELEASE: ${{ secrets.DISCORD_WEBHOOK_RELEASE }}
- name: Test
run: pnpm run ci
- name: Build
env:
SYNC_DROPBOX_CLIENT_ID: ${{ secrets.SYNC_DROPBOX_CLIENT_ID }}
SYNC_GOOGLE_DESKTOP_ID: ${{ secrets.SYNC_GOOGLE_DESKTOP_ID }}
SYNC_GOOGLE_DESKTOP_SECRET: ${{ secrets.SYNC_GOOGLE_DESKTOP_SECRET }}
SYNC_ONEDRIVE_CLIENT_ID: ${{ secrets.SYNC_ONEDRIVE_CLIENT_ID }}
run: |
mkdir -p $ASSETS_DIR $TEMP_DIR
pnpm build
cd dist && zip -r ../$ASSETS_DIR/$ASSET_ZIP . && cd ..
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Publish to Edge
run: |
if [ "$PRERELEASE" != "true" ]; then
if ! deno run -A https://raw.githubusercontent.com/violentmonkey/publish-edge-ext/main/main.ts $ASSETS_DIR/$ASSET_ZIP 2>"$TEMP_DIR/stderr.log"; then
export ERROR=$(cat "$TEMP_DIR/stderr.log" 2>/dev/null || true)
ERROR="${ERROR:-Edge publish failed}"
fi
export TARGET=Edge
node scripts/notify-release.mjs
else
echo Skip BETA for Edge
fi
env:
CLIENT_ID: ${{ secrets.EDGE_CLIENT_ID }}
API_KEY: ${{ secrets.EDGE_API_KEY }}
PRODUCT_ID: ${{ secrets.EDGE_PRODUCT_ID }}
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 for Edge on: workflow_dispatch: push: tags: - v* concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@v1 # v1 keeps tags with: fetch-depth: 250 # for `action-helper` # persist-credentials: false # not implemented in v1 - uses: pnpm/action-setup@v6 - uses: actions/setup-node@v6 with: cache: 'npm' node-version-file: 'package.json' - name: Prepare run: pnpm i && node scripts/action-helper.js env: ACTION_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} DISCORD_WEBHOOK_RELEASE: ${{ secrets.DISCORD_WEBHOOK_RELEASE }} - name: Test run: pnpm run ci - name: Build env: SYNC_DROPBOX_CLIENT_ID: ${{ secrets.SYNC_DROPBOX_CLIENT_ID }} SYNC_GOOGLE_DESKTOP_ID: ${{ secrets.SYNC_GOOGLE_DESKTOP_ID }} SYNC_GOOGLE_DESKTOP_SECRET: ${{ secrets.SYNC_GOOGLE_DESKTOP_SECRET }} SYNC_ONEDRIVE_CLIENT_ID: ${{ secrets.SYNC_ONEDRIVE_CLIENT_ID }} run: | mkdir -p $ASSETS_DIR $TEMP_DIR pnpm build cd dist && zip -r ../$ASSETS_DIR/$ASSET_ZIP . && cd .. - uses: denoland/setup-deno@v2 with: deno-version: v2.x - name: Publish to Edge run: | if [ "$PRERELEASE" != "true" ]; then if ! deno run -A https://raw.githubusercontent.com/violentmonkey/publish-edge-ext/main/main.ts $ASSETS_DIR/$ASSET_ZIP 2>"$TEMP_DIR/stderr.log"; then export ERROR=$(cat "$TEMP_DIR/stderr.log" 2>/dev/null || true) ERROR="${ERROR:-Edge publish failed}" fi export TARGET=Edge node scripts/notify-release.mjs else echo Skip BETA for Edge fi env: CLIENT_ID: ${{ secrets.EDGE_CLIENT_ID }} API_KEY: ${{ secrets.EDGE_API_KEY }} PRODUCT_ID: ${{ secrets.EDGE_PRODUCT_ID }}
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.
- 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.
2 third-party actions are referenced by a movable tag. Pin them 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.