Skip to content
Latchkey

release workflow (square/moshi)

The release workflow from square/moshi, explained and optimized by Latchkey.

F

CI health: F - at risk

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: square/moshi.github/workflows/release.ymlLicense Apache-2.0View source

What it does

This is the release workflow from the square/moshi 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

on:
  push:
    tags:
      - '**'

jobs:
  release:
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-java@v5
        with:
          distribution: 'zulu'
          java-version-file: .github/workflows/.java-version
      - uses: gradle/actions/setup-gradle@v6
      - run: ./gradlew publish dokkaGenerate -PmavenCentralDeploymentValidation=PUBLISHED
        env:
          ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
          ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}
          ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }}
          ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SECRET_PASSPHRASE }}

      - name: Extract release notes
        id: release_notes
        uses: ffurrer2/extract-release-notes@v3

      - name: Create release
        uses: softprops/action-gh-release@v3
        with:
          body: ${{ steps.release_notes.outputs.release_notes }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Deploy docs to website
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: site
          FOLDER: docs/2.x/
          TARGET_FOLDER: docs/2.x/
          CLEAN: 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
 
on:
  push:
    tags:
      - '**'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  release:
    timeout-minutes: 30
    runs-on: macos-latest
 
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-java@v5
        with:
          cache: 'maven'
          distribution: 'zulu'
          java-version-file: .github/workflows/.java-version
      - uses: gradle/actions/setup-gradle@v6
      - run: ./gradlew publish dokkaGenerate -PmavenCentralDeploymentValidation=PUBLISHED
        env:
          ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
          ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}
          ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }}
          ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SECRET_PASSPHRASE }}
 
      - name: Extract release notes
        id: release_notes
        uses: ffurrer2/extract-release-notes@v3
 
      - name: Create release
        uses: softprops/action-gh-release@v3
        with:
          body: ${{ steps.release_notes.outputs.release_notes }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
      - name: Deploy docs to website
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: site
          FOLDER: docs/2.x/
          TARGET_FOLDER: docs/2.x/
          CLEAN: true
 

What changed

4 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.

Actions used in this workflow