Remnashop - Dev workflow (snoups/remnashop)
The Remnashop - Dev workflow from snoups/remnashop, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Remnashop - Dev workflow from the snoups/remnashop 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
name: Remnashop - Dev
on:
push:
branches:
- dev
jobs:
docker-build:
name: ποΈ Build and Push Docker Image
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.vars.outputs.image_tag }}
short_sha: ${{ steps.vars.outputs.short_sha }}
steps:
- name: π§Ύ Checkout Repository
uses: actions/checkout@v4
- name: π οΈ Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: π Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: π·οΈ Define Tags & Outputs
id: vars
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
IMAGE_REPO="ghcr.io/${GITHUB_REPOSITORY}"
IMAGE_TAGS="${IMAGE_REPO}:dev,${IMAGE_REPO}:dev-${SHORT_SHA}"
echo "image_tag=${IMAGE_TAGS}" >> $GITHUB_OUTPUT
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "build_time=${BUILD_TIME}" >> $GITHUB_OUTPUT
echo "β
Tags: ${IMAGE_TAGS}"
echo "β
SHA: ${SHORT_SHA}"
- name: ποΈ Build and Push Image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.vars.outputs.image_tag }}
build-args: |
BUILD_TIME=${{ steps.vars.outputs.build_time }}
BUILD_BRANCH=${{ github.ref_name }}
BUILD_COMMIT=${{ steps.vars.outputs.short_sha }}
BUILD_TAG=dev
release:
name: π¦ Build and Publish Dev Artifact
runs-on: ubuntu-latest
needs: docker-build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHORT_SHA: ${{ needs.docker-build.outputs.short_sha }}
steps:
- name: π§Ύ Checkout Repository
uses: actions/checkout@v4
- name: π§± Generate Build Metadata
run: |
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
BRANCH="${{ github.ref_name }}"
FULL_SHA="${{ github.sha }}"
COMMIT_URL="https://github.com/${{ github.repository }}/commit/$SHORT_SHA"
TAG_VALUE=$(grep -m1 '"version":' package.json | cut -d'"' -f4 || true)
if [ -z "$TAG_VALUE" ]; then
JSON_TAG="null"
else
JSON_TAG="\"$TAG_VALUE\""
fi
cat <<EOF > build.info.json
{
"buildTime": "$BUILD_TIME",
"commitFull": "$FULL_SHA",
"commit": "$SHORT_SHA",
"tag": $JSON_TAG,
"branch": "$BRANCH",
"commitUrl": "$COMMIT_URL"
}
EOF
echo "β
Generated build.info.json"
- name: π Archive Project Files
run: |
zip -r remnashop-dev.zip . \
-x ".git/*" ".github/*" "logs/*" "*.zip" "node_modules/*"
- name: π§Ή Remove Previous Artifact
continue-on-error: true
run: gh release delete-asset dev-build remnashop-dev.zip || true
- name: β¬οΈ Upload Artifact to Release
run: gh release upload dev-build remnashop-dev.zip --clobber
- name: π Update Release Notes
run: |
COMMIT_URL="https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
DATE=$(date -u +'%Y-%m-%d %H:%M:%S UTC')
gh release edit dev-build --notes-file - <<EOF
π Updated development build
π [Commit]($COMMIT_URL)
π·οΈ Tags:
β’ \`dev\`
β’ \`dev-$SHORT_SHA\`
π
Built: $DATE
EOF
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Remnashop - Dev on: push: branches: - dev concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: docker-build: timeout-minutes: 30 name: ποΈ Build and Push Docker Image runs-on: latchkey-small outputs: image_tag: ${{ steps.vars.outputs.image_tag }} short_sha: ${{ steps.vars.outputs.short_sha }} steps: - name: π§Ύ Checkout Repository uses: actions/checkout@v4 - name: π οΈ Set Up Docker Buildx uses: docker/setup-buildx-action@v3 - name: π Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GHCR_TOKEN }} - name: π·οΈ Define Tags & Outputs id: vars run: | SHORT_SHA=$(git rev-parse --short HEAD) BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") IMAGE_REPO="ghcr.io/${GITHUB_REPOSITORY}" IMAGE_TAGS="${IMAGE_REPO}:dev,${IMAGE_REPO}:dev-${SHORT_SHA}" echo "image_tag=${IMAGE_TAGS}" >> $GITHUB_OUTPUT echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT echo "build_time=${BUILD_TIME}" >> $GITHUB_OUTPUT echo "β Tags: ${IMAGE_TAGS}" echo "β SHA: ${SHORT_SHA}" - name: ποΈ Build and Push Image uses: docker/build-push-action@v5 with: context: . push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.vars.outputs.image_tag }} build-args: | BUILD_TIME=${{ steps.vars.outputs.build_time }} BUILD_BRANCH=${{ github.ref_name }} BUILD_COMMIT=${{ steps.vars.outputs.short_sha }} BUILD_TAG=dev release: timeout-minutes: 30 name: π¦ Build and Publish Dev Artifact runs-on: latchkey-small needs: docker-build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SHORT_SHA: ${{ needs.docker-build.outputs.short_sha }} steps: - name: π§Ύ Checkout Repository uses: actions/checkout@v4 - name: π§± Generate Build Metadata run: | BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") BRANCH="${{ github.ref_name }}" FULL_SHA="${{ github.sha }}" COMMIT_URL="https://github.com/${{ github.repository }}/commit/$SHORT_SHA" TAG_VALUE=$(grep -m1 '"version":' package.json | cut -d'"' -f4 || true) if [ -z "$TAG_VALUE" ]; then JSON_TAG="null" else JSON_TAG="\"$TAG_VALUE\"" fi cat <<EOF > build.info.json { "buildTime": "$BUILD_TIME", "commitFull": "$FULL_SHA", "commit": "$SHORT_SHA", "tag": $JSON_TAG, "branch": "$BRANCH", "commitUrl": "$COMMIT_URL" } EOF echo "β Generated build.info.json" - name: π Archive Project Files run: | zip -r remnashop-dev.zip . \ -x ".git/*" ".github/*" "logs/*" "*.zip" "node_modules/*" - name: π§Ή Remove Previous Artifact continue-on-error: true run: gh release delete-asset dev-build remnashop-dev.zip || true - name: β¬οΈ Upload Artifact to Release run: gh release upload dev-build remnashop-dev.zip --clobber - name: π Update Release Notes run: | COMMIT_URL="https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" DATE=$(date -u +'%Y-%m-%d %H:%M:%S UTC') gh release edit dev-build --notes-file - <<EOF π Updated development build π [Commit]($COMMIT_URL) π·οΈ Tags: β’ \`dev\` β’ \`dev-$SHORT_SHA\` π Built: $DATE EOF
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. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
3 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.
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:
- Container pulls and builds
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.