chocolatey workflow (ipfs/ipfs-desktop)
The chocolatey workflow from ipfs/ipfs-desktop, explained and optimized by Latchkey.
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 chocolatey workflow from the ipfs/ipfs-desktop 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: chocolatey
on:
workflow_dispatch:
inputs:
manual_name:
required: true
description: 'Release number to publish'
default: 'v0.0.0'
release:
types: [published]
env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
release_name: ${{ github.event.inputs.manual_name || github.event.release.name }}
jobs:
publish:
runs-on: windows-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v7
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: '18.17.1'
- name: Cache bigger downloads
uses: actions/cache@v6
id: cache
with:
path: ${{ github.workspace }}/.cache
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
${{ runner.os }}-
- name: Strip 'v' prefix and save as CHOCO_RELEASE_NAME
id: name
shell: bash
run: |
TAG=${{ github.event.inputs.manual_name || github.event.release.name }}
echo "CHOCO_RELEASE_NAME=${TAG#v}" >> $GITHUB_ENV
- name: Install dependencies
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
- name: Download .exe, update version, URL and hash
run: node update.mjs ${{ env.CHOCO_RELEASE_NAME }}
working-directory: .\pkgs\chocolatey
- name: Create .nupkg
run: choco pack
working-directory: .\pkgs\chocolatey
- name: Publish to Chocolatey
run: choco push ipfs-desktop.${{ env.CHOCO_RELEASE_NAME }}.nupkg --key ${{ secrets.chocolatey_key }} --source "https://push.chocolatey.org"
working-directory: .\pkgs\chocolatey
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: chocolatey on: workflow_dispatch: inputs: manual_name: required: true description: 'Release number to publish' default: 'v0.0.0' release: types: [published] env: XDG_CACHE_HOME: ${{ github.workspace }}/.cache ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder release_name: ${{ github.event.inputs.manual_name || github.event.release.name }} jobs: publish: timeout-minutes: 30 runs-on: windows-latest steps: - name: Check out Git repository uses: actions/checkout@v7 - name: Install Node.js uses: actions/setup-node@v6 with: cache: 'npm' node-version: '18.17.1' - name: Cache bigger downloads uses: actions/cache@v6 id: cache with: path: ${{ github.workspace }}/.cache key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }} restore-keys: | ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }} ${{ runner.os }}- - name: Strip 'v' prefix and save as CHOCO_RELEASE_NAME id: name shell: bash run: | TAG=${{ github.event.inputs.manual_name || github.event.release.name }} echo "CHOCO_RELEASE_NAME=${TAG#v}" >> $GITHUB_ENV - name: Install dependencies run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm - name: Download .exe, update version, URL and hash run: node update.mjs ${{ env.CHOCO_RELEASE_NAME }} working-directory: .\pkgs\chocolatey - name: Create .nupkg run: choco pack working-directory: .\pkgs\chocolatey - name: Publish to Chocolatey run: choco push ipfs-desktop.${{ env.CHOCO_RELEASE_NAME }}.nupkg --key ${{ secrets.chocolatey_key }} --source "https://push.chocolatey.org" working-directory: .\pkgs\chocolatey
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.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.