Skip to content

Extract common operations to reusable scripts in base images #38

Extract common operations to reusable scripts in base images

Extract common operations to reusable scripts in base images #38

Workflow file for this run

on:
push:
branches:
- main
- dev
pull_request:
name: Release - Build, Test, and Push
jobs:
build:
name: Build, Test, and Push images
runs-on: ubuntu-latest-4x
concurrency:
group: bake-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config: ./share/buildkitd.toml
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GCAR us-central1
continue-on-error: true
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'
- name: Login to GCAR us
continue-on-error: true
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'
- name: Login to GCAR asia
continue-on-error: true
uses: docker/login-action@v3
with:
registry: asia-docker.pkg.dev
username: _json_key
password: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'
- name: Login to GCAR europe
continue-on-error: true
uses: docker/login-action@v3
with:
registry: europe-docker.pkg.dev
username: _json_key
password: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'
- name: Build
id: build
uses: docker/bake-action@v4
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,compression=zstd
targets: "build"
push: false
- name: Test
run: |
just -f build.justfile test
- name: Push
id: push
if: github.ref == 'refs/heads/main'
uses: docker/bake-action@v4
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,compression=zstd
targets: "build"
push: true
build-content:
name: Build content images
runs-on: ubuntu-latest-4x
concurrency:
group: bake-content-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config: ./share/buildkitd.toml
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build
id: build
uses: docker/bake-action@v4
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,compression=zstd
workdir: content/.
push: false
- name: Push
id: push
if: github.ref == 'refs/heads/main'
uses: docker/bake-action@v4
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,compression=zstd
workdir: content/.
push: true