Deploy to App Engine workflow (RaspberryPiFoundation/blockly)
The Deploy to App Engine workflow from RaspberryPiFoundation/blockly, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Deploy to App Engine workflow from the RaspberryPiFoundation/blockly 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 that prepares files and deploys to appengine
name: Deploy to App Engine
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
# Checks-out the repository under $GITHUB_WORKSPACE.
# When running manually this checks out the master branch.
- uses: actions/checkout@v7
- name: Prepare demo files
# Install all dependencies, then copy all the files needed for demos.
run: |
cd packages/blockly
npm install
npm run prepareDemos
- name: Upload
uses: actions/upload-artifact@v7
with:
name: appengine_files
path: _deploy/
deploy:
name: Deploy
runs-on: ubuntu-latest
# The prepare step must succeed for this step to run.
needs: prepare
steps:
- name: Download prepared files
uses: actions/download-artifact@v8
with:
name: appengine_files
path: _deploy/
- name: Deploy to App Engine
uses: google-github-actions/deploy-appengine@v3.0.1
# For parameters see:
# https://github.com/google-github-actions/deploy-appengine#inputs
with:
working_directory: _deploy/
deliverables: app.yaml
project_id: ${{ secrets.GCP_PROJECT }}
credentials: ${{ secrets.GCP_SA_KEY }}
promote: false
version: vtest
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Workflow that prepares files and deploys to appengine name: Deploy to App Engine # Controls when the workflow will run on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: prepare: timeout-minutes: 30 name: Prepare runs-on: latchkey-small steps: # Checks-out the repository under $GITHUB_WORKSPACE. # When running manually this checks out the master branch. - uses: actions/checkout@v7 - name: Prepare demo files # Install all dependencies, then copy all the files needed for demos. run: | cd packages/blockly npm install npm run prepareDemos - name: Upload uses: actions/upload-artifact@v7 with: name: appengine_files path: _deploy/ deploy: timeout-minutes: 30 name: Deploy runs-on: latchkey-small # The prepare step must succeed for this step to run. needs: prepare steps: - name: Download prepared files uses: actions/download-artifact@v8 with: name: appengine_files path: _deploy/ - name: Deploy to App Engine uses: google-github-actions/deploy-appengine@v3.0.1 # For parameters see: # https://github.com/google-github-actions/deploy-appengine#inputs with: working_directory: _deploy/ deliverables: app.yaml project_id: ${{ secrets.GCP_PROJECT }} credentials: ${{ secrets.GCP_SA_KEY }} promote: false version: vtest
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it 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:
- Dependency installs
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.