Build and Publish Images & Features #462
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Images & Features | |
on: | |
schedule: | |
- cron: "0 3 * * *" # Run every day at 3am | |
push: | |
branches: | |
- main | |
jobs: | |
base: | |
name: Build and Publish Base Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./images/base | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/base:buildcache | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/base:buildcache | |
tags: ghcr.io/${{ github.repository_owner }}/base:latest | |
push: true | |
dind: | |
name: Build and Publish Docker-in-Docker Image | |
runs-on: ubuntu-latest | |
needs: [base] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./images/dind | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/dind:buildcache | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/dind:buildcache | |
tags: ghcr.io/${{ github.repository_owner }}/dind:latest | |
push: true | |
devcontainer_base: | |
name: Build and Publish Devcontainer Base Image | |
runs-on: ubuntu-latest | |
needs: [dind] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./images/devcontainer-base | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/devcontainer-base:buildcache | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/devcontainer-base:buildcache | |
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:latest | |
push: true | |
firebase_toolkit: | |
name: Build and Publish Firebase Toolkit Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./images/firebase-toolkit | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/firebase-toolkit:buildcache | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/firebase-toolkit:buildcache | |
tags: ghcr.io/${{ github.repository_owner }}/firebase-toolkit:latest | |
push: true | |
runner: | |
name: Build and Publish Runner Image | |
runs-on: ubuntu-latest | |
needs: [base] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./images/runner | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runner:buildcache | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runner:buildcache | |
tags: ghcr.io/${{ github.repository_owner }}/runner:latest | |
push: true | |
features: | |
name: Build and Publish Features | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: "Publish Features" | |
uses: devcontainers/action@v1 | |
with: | |
publish-features: "true" | |
base-path-to-features: "./features/src" | |
disable-repo-tagging: "true" | |
features-namespace: "onezerocompany/devcontainers/features" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
templates: | |
name: Build and Publish Templates | |
runs-on: ubuntu-latest | |
needs: [features] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: "Publish Templates" | |
uses: devcontainers/action@v1 | |
with: | |
publish-templates: "true" | |
base-path-to-templates: "./templates/src" | |
disable-repo-tagging: "true" | |
templates-namespace: "onezerocompany/devcontainers/templates" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
devcontainers: | |
name: Build and Publish Devcontainers | |
runs-on: ubuntu-latest | |
needs: [features, devcontainer_base] | |
strategy: | |
fail-fast: false | |
matrix: | |
devcontainer: | |
[ | |
{ id: flutter, platforms: "linux/amd64" }, | |
{ id: astro, platforms: "linux/amd64,linux/arm64" }, | |
{ id: minimal, platforms: "linux/amd64,linux/arm64" }, | |
{ id: containers, platforms: "linux/amd64,linux/arm64" }, | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Devcontainer | |
uses: devcontainers/[email protected] | |
env: | |
BUILDX_NO_DEFAULT_ATTESTATIONS: true | |
with: | |
subFolder: devcontainers/${{ matrix.devcontainer.id }} | |
imageName: ghcr.io/${{ github.repository_owner }}/devcontainer/${{ matrix.devcontainer.id }} | |
push: filter | |
refFilterForPush: refs/heads/main | |
platform: ${{ matrix.devcontainer.platforms }} | |
imageTag: latest |