Skip to content
Latchkey

Deploy to DigitalOcean Spaces workflow (digitalocean/nginxconfig.io)

The Deploy to DigitalOcean Spaces workflow from digitalocean/nginxconfig.io, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get 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: digitalocean/nginxconfig.io.github/workflows/do-spaces-workflow.ymlLicense MITView source

What it does

This is the Deploy to DigitalOcean Spaces workflow from the digitalocean/nginxconfig.io 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: Deploy to DigitalOcean Spaces

on: push

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version-file: .nvmrc
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Build tool
        run: npm run build
        env:
          NODE_ENV: production

      - name: Deploy commit to DigitalOcean Spaces
        run: aws s3 sync ./dist s3://${{ secrets.SPACES_BUCKET }}/commits/nginxconfig/${{ github.sha }} --endpoint=https://${{ secrets.SPACES_REGION }}.digitaloceanspaces.com --acl public-read --content-encoding utf8
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: ${{ secrets.SPACES_REGION }}

      - name: Leave a comment on commit
        run: npm run deploy:spaces:comment
        env:
          REPO_NAME: ${{ github.repository }}
          COMMIT_SHA: ${{ github.sha }}
          GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SPACES_REGION: ${{ secrets.SPACES_REGION }}
          SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }}

The same workflow, on Latchkey

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

name: Deploy to DigitalOcean Spaces
 
on: push
 
permissions:
  contents: write
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    steps:
      - name: Checkout
        uses: actions/checkout@v3
 
      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version-file: .nvmrc
          cache: npm
 
      - name: Install dependencies
        run: npm ci
 
      - name: Build tool
        run: npm run build
        env:
          NODE_ENV: production
 
      - name: Deploy commit to DigitalOcean Spaces
        run: aws s3 sync ./dist s3://${{ secrets.SPACES_BUCKET }}/commits/nginxconfig/${{ github.sha }} --endpoint=https://${{ secrets.SPACES_REGION }}.digitaloceanspaces.com --acl public-read --content-encoding utf8
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: ${{ secrets.SPACES_REGION }}
 
      - name: Leave a comment on commit
        run: npm run deploy:spaces:comment
        env:
          REPO_NAME: ${{ github.repository }}
          COMMIT_SHA: ${{ github.sha }}
          GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SPACES_REGION: ${{ secrets.SPACES_REGION }}
          SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }}
 

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