Skip to content
Latchkey

CD workflow (s-yadav/react-number-format)

The CD workflow from s-yadav/react-number-format, explained and optimized by Latchkey.

D

CI health: D - needs work

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: s-yadav/react-number-format.github/workflows/CD.ymlLicense MITView source

What it does

This is the CD workflow from the s-yadav/react-number-format 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: CD

on:
  push:
    tags:
      - '*'

jobs:
  publish:
    name: Package publish using node ${{ matrix.node }}
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        node: [14]
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2
      - name: Use node ${{ matrix.node }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}
          registry-url: https://registry.npmjs.org
      - name: install
        run: yarn
      - name: yarn lint
        run: yarn run lint
      - name: build
        run: yarn run build
      - name: release
        run: yarn publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

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: CD
 
on:
  push:
    tags:
      - '*'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  publish:
    timeout-minutes: 30
    name: Package publish using node ${{ matrix.node }}
    runs-on: ${{ matrix.os }}
 
    strategy:
      fail-fast: false
      matrix:
        node: [14]
        os: [ubuntu-latest]
 
    steps:
      - uses: actions/checkout@v2
      - name: Use node ${{ matrix.node }}
        uses: actions/setup-node@v2
        with:
          cache: 'npm'
          node-version: ${{ matrix.node }}
          registry-url: https://registry.npmjs.org
      - name: install
        run: yarn
      - name: yarn lint
        run: yarn run lint
      - name: build
        run: yarn run build
      - name: release
        run: yarn publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
 

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.

Actions used in this workflow