Skip to content
Latchkey

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

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

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, 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: awslabs/amazon-s3-find-and-forget.github/workflows/release.yamlLicense Apache-2.0View source

What it does

This is the Release 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: Release Version
on:
  push:
    branches:
      - master
permissions:
  contents: write

jobs:
  release:
    name: Release Version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
      # Cache
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      # Setup
      - name: Set up Python 3.12
        uses: actions/setup-python@v1
        with:
          python-version: 3.12
      - name: Install virtualenv
        run: pip install virtualenv
      - name: Install dependencies
        run: make setup-predeploy
      # Release if required
      - name: Setup versions in env variables
        id: version
        run: |
          function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
          echo "THIS_VERSION=$(make version | sed s/^v//)" >> $GITHUB_ENV
          echo "THIS_VERSION_COMPARABLE=$(version $(make version | sed s/^v//))" >> $GITHUB_ENV
          echo "LATEST_VERSION_COMPARABLE=$(version $(git describe --tags $(git rev-list --tags --max-count=1) | sed s/^v// 2> /dev/null || echo '0'))" >> $GITHUB_ENV
      - name: Create Release
        id: create_release
        uses: actions/create-release@latest
        if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE
        env:
          GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
        with:
          tag_name: v${{ env.THIS_VERSION }}
          release_name: Release v${{ env.THIS_VERSION }}
          body: |
            See the CHANGELOG for a list of features included in this release
          draft: false
          prerelease: true

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 Version
on:
  push:
    branches:
      - master
permissions:
  contents: write
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  release:
    timeout-minutes: 30
    name: Release Version
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v2
      - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
      # Cache
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      # Setup
      - name: Set up Python 3.12
        uses: actions/setup-python@v1
        with:
          cache: 'pip'
          python-version: 3.12
      - name: Install virtualenv
        run: pip install virtualenv
      - name: Install dependencies
        run: make setup-predeploy
      # Release if required
      - name: Setup versions in env variables
        id: version
        run: |
          function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
          echo "THIS_VERSION=$(make version | sed s/^v//)" >> $GITHUB_ENV
          echo "THIS_VERSION_COMPARABLE=$(version $(make version | sed s/^v//))" >> $GITHUB_ENV
          echo "LATEST_VERSION_COMPARABLE=$(version $(git describe --tags $(git rev-list --tags --max-count=1) | sed s/^v// 2> /dev/null || echo '0'))" >> $GITHUB_ENV
      - name: Create Release
        id: create_release
        uses: actions/create-release@latest
        if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE
        env:
          GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
        with:
          tag_name: v${{ env.THIS_VERSION }}
          release_name: Release v${{ env.THIS_VERSION }}
          body: |
            See the CHANGELOG for a list of features included in this release
          draft: false
          prerelease: true
 

What changed

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