ci: faster pipelines with checks-only ci and registry build cache
CI / checks (push) Failing after 2m8s
CI / checks (push) Failing after 2m8s
Drop duplicate Next.js builds from CI, skip release commits, and cancel stale runs. Cache pnpm on runners and use buildx registry cache for releases.
This commit is contained in:
@@ -9,6 +9,10 @@ on:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -27,8 +31,15 @@ jobs:
|
||||
echo "image=registry.ginnoir.com/ginnoir/famapp"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install docker
|
||||
run: apt-get update -qq && apt-get install -y -qq docker.io
|
||||
- name: Ensure docker CLI
|
||||
run: |
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
echo "docker already available"
|
||||
docker version
|
||||
exit 0
|
||||
fi
|
||||
apt-get update -qq && apt-get install -y -qq docker.io
|
||||
docker version
|
||||
|
||||
- name: Login to registry
|
||||
run: |
|
||||
@@ -36,16 +47,23 @@ jobs:
|
||||
--username "${{ secrets.REGISTRY_PUSH_USERNAME }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Build image
|
||||
- name: Set up buildx
|
||||
run: |
|
||||
docker build \
|
||||
-t "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}" \
|
||||
-t "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.major_minor }}" \
|
||||
-t "${{ steps.meta.outputs.image }}:latest" \
|
||||
.
|
||||
docker buildx create --name famapp-builder --use 2>/dev/null || docker buildx use famapp-builder
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: Push image
|
||||
- name: Build and push image
|
||||
env:
|
||||
IMAGE: ${{ steps.meta.outputs.image }}
|
||||
VERSION: ${{ steps.meta.outputs.version }}
|
||||
MAJOR_MINOR: ${{ steps.meta.outputs.major_minor }}
|
||||
CACHE: registry.ginnoir.com/ginnoir/famapp:buildcache
|
||||
run: |
|
||||
docker push "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}"
|
||||
docker push "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.major_minor }}"
|
||||
docker push "${{ steps.meta.outputs.image }}:latest"
|
||||
docker buildx build \
|
||||
--push \
|
||||
--tag "${IMAGE}:${VERSION}" \
|
||||
--tag "${IMAGE}:${MAJOR_MINOR}" \
|
||||
--tag "${IMAGE}:latest" \
|
||||
--cache-from "type=registry,ref=${CACHE}" \
|
||||
--cache-to "type=registry,ref=${CACHE},mode=max" \
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user