Skip to content
Latchkey

snapcraft workflow (ipfs/ipfs-desktop)

The snapcraft workflow from ipfs/ipfs-desktop, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: ipfs/ipfs-desktop.github/workflows/snapcraft.ymlLicense MITView source

What it does

This is the snapcraft 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

workflow (.yml)
name: snapcraft

on:
  workflow_dispatch:
    inputs:
      manual_name:
        required: true
        description: 'Release number to publish'
        default: 'v0.0.0'
  release:
    types: [published]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Strip 'v' prefix
        id: name
        run: |
          TAG=${{ github.event.inputs.manual_name || github.event.release.name }}
          echo "SNAP_RELEASE_NAME=${TAG#v}" >> $GITHUB_ENV
      - name: Download .snap artifact
        uses: dsaltares/fetch-gh-release-asset@aa2ab1243d6e0d5b405b973c89fa4d06a2d0fff7 # v1.1.2
        with:
          repo: ipfs/ipfs-desktop
          version: tags/v${{ env.SNAP_RELEASE_NAME }}
          file: ipfs-desktop-${{ env.SNAP_RELEASE_NAME }}-linux-amd64.snap
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: Publish to Snapcraft
        uses: snapcore/action-publish@214b86e5ca036ead1668c79afb81e550e6c54d40 # v1.2.0
        env:
          SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
        with:
          snap: ipfs-desktop-${{ env.SNAP_RELEASE_NAME }}-linux-amd64.snap
          release: stable

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: snapcraft
 
on:
  workflow_dispatch:
    inputs:
      manual_name:
        required: true
        description: 'Release number to publish'
        default: 'v0.0.0'
  release:
    types: [published]
 
jobs:
  publish:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Strip 'v' prefix
        id: name
        run: |
          TAG=${{ github.event.inputs.manual_name || github.event.release.name }}
          echo "SNAP_RELEASE_NAME=${TAG#v}" >> $GITHUB_ENV
      - name: Download .snap artifact
        uses: dsaltares/fetch-gh-release-asset@aa2ab1243d6e0d5b405b973c89fa4d06a2d0fff7 # v1.1.2
        with:
          repo: ipfs/ipfs-desktop
          version: tags/v${{ env.SNAP_RELEASE_NAME }}
          file: ipfs-desktop-${{ env.SNAP_RELEASE_NAME }}-linux-amd64.snap
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: Publish to Snapcraft
        uses: snapcore/action-publish@214b86e5ca036ead1668c79afb81e550e6c54d40 # v1.2.0
        env:
          SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
        with:
          snap: ipfs-desktop-${{ env.SNAP_RELEASE_NAME }}-linux-amd64.snap
          release: stable
 

What changed

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.