Skip to content
Latchkey

Publish Version workflow (awslabs/amazon-s3-find-and-forget)

The Publish Version workflow from awslabs/amazon-s3-find-and-forget, explained and optimized by Latchkey.

C

CI health: C - fair

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

Grade your own workflow free or run it on Latchkey →
Source: awslabs/amazon-s3-find-and-forget.github/workflows/publish.yamlLicense Apache-2.0View source

What it does

This is the Publish Version workflow from the awslabs/amazon-s3-find-and-forget 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: Publish Version
on:
  release:
    types: [created, edited]
permissions:
  contents: read

jobs:
  publish:
    name: Publish Version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Fetch Tags
        run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
          aws-region: ${{ secrets.REGION }}
      - name: Set version
        id: version
        run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
      # Cache
      - uses: actions/cache@v4
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      # Setup
      - name: Install Snappy
        run: sudo apt-get install libsnappy-dev
      - name: Set up Python 3.12
        uses: actions/setup-python@v1
        with:
          python-version: 3.12
      - name: Set up Nodejs 20
        uses: actions/setup-node@v1
        with:
          node-version: 20
      - name: Set up ruby 3.3
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3'
      - name: Install virtualenv
        run: pip install virtualenv
      - name: Install dependencies
        run: make setup
      # Package and Upload Archive
      - name: Build Release
        run: make package
      - name: Upload artefact
        run: aws s3 cp packaged.zip s3://$CFN_BUCKET/amazon-s3-find-and-forget/$VERSION/amazon-s3-find-and-forget.zip
        env:
          CFN_BUCKET: ${{ secrets.CFN_BUCKET }}

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: Publish Version
on:
  release:
    types: [created, edited]
permissions:
  contents: read
 
jobs:
  publish:
    timeout-minutes: 30
    name: Publish Version
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v2
      - name: Fetch Tags
        run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
          aws-region: ${{ secrets.REGION }}
      - name: Set version
        id: version
        run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
      # Cache
      - uses: actions/cache@v4
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      # Setup
      - name: Install Snappy
        run: sudo apt-get install libsnappy-dev
      - name: Set up Python 3.12
        uses: actions/setup-python@v1
        with:
          python-version: 3.12
      - name: Set up Nodejs 20
        uses: actions/setup-node@v1
        with:
          cache: 'npm'
          node-version: 20
      - name: Set up ruby 3.3
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3'
      - name: Install virtualenv
        run: pip install virtualenv
      - name: Install dependencies
        run: make setup
      # Package and Upload Archive
      - name: Build Release
        run: make package
      - name: Upload artefact
        run: aws s3 cp packaged.zip s3://$CFN_BUCKET/amazon-s3-find-and-forget/$VERSION/amazon-s3-find-and-forget.zip
        env:
          CFN_BUCKET: ${{ secrets.CFN_BUCKET }}
 

What changed

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.

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:

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

Actions used in this workflow