chore: Change the webhook event schema (#420) #260
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: Docker Build | |
on: | |
release: | |
types: | |
- published | |
push: | |
branches: | |
- main | |
- '*docker*' | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
max-parallel: 8 | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
image_type: | |
- name: meteroid-api | |
dockerfile: modules/meteroid/api.Dockerfile | |
- name: meteroid-scheduler | |
dockerfile: modules/meteroid/scheduler.Dockerfile | |
- name: metering-api | |
dockerfile: modules/metering/Dockerfile | |
- name: meteroid-web | |
dockerfile: modules/web/web-app/Dockerfile | |
include: | |
- platform: linux/amd64 | |
mold_arch: x86_64 | |
proto_arch: x86_64 | |
grpc_health_probe_arch: amd64 | |
prefix: amd64 | |
runs_on: ubuntu-latest | |
- platform: linux/arm64 | |
mold_arch: aarch64 | |
proto_arch: aarch_64 | |
grpc_health_probe_arch: arm64 | |
prefix: arm64 | |
runs_on: ubuntu-latest | |
runs-on: ${{ matrix.runs_on }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Cargo CI config | |
run: | | |
mkdir -p .cargo && ln -s ../.cargo-templates/ci.toml $_/config.toml | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meteroid-docker # you'll use this in the next step | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/meteroid-oss/${{ matrix.image_type.name }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
flavor: | | |
latest=false | |
prefix=${{ matrix.prefix }}- | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ${{ matrix.image_type.dockerfile }} | |
platforms: ${{ matrix.platform }} | |
build-args: | | |
MOLD_ARCH=${{ matrix.mold_arch }} | |
PROTO_ARCH=${{ matrix.proto_arch }} | |
GRPC_HEALTH_PROBE_ARCH=${{ matrix.grpc_health_probe_arch }} | |
PROFILE=release | |
CI=${{ env.CI }} | |
push: true | |
tags: | | |
${{ steps.meteroid-docker.outputs.tags }} | |
ghcr.io/meteroid-oss/${{ matrix.image_type.name }}:${{ github.sha }} | |
labels: ${{ steps.meteroid-docker.outputs.labels }} | |
# layer caching | |
cache-from: type=gha | |
cache-to: type=gha,mode=max,ignore-error=true | |
# https://github.com/docker/build-push-action/issues/900 | |
provenance: false | |
manifest: | |
needs: build | |
strategy: | |
matrix: | |
image_type: | |
- meteroid-api | |
- meteroid-scheduler | |
- metering-api | |
- meteroid-web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meteroid-docker # you'll use this in the next step | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/meteroid-oss/${{ matrix.image_type }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Create and push Docker manifest | |
run: | | |
TAG=${{ steps.meteroid-docker.outputs.version }} | |
IMAGE=ghcr.io/meteroid-oss/${{ matrix.image_type }} | |
docker manifest create ${IMAGE}:${TAG} ${IMAGE}:arm64-${TAG} ${IMAGE}:amd64-${TAG} | |
docker manifest annotate ${IMAGE}:${TAG} ${IMAGE}:arm64-${TAG} --arch arm64 | |
docker manifest annotate ${IMAGE}:${TAG} ${IMAGE}:amd64-${TAG} --arch amd64 | |
docker manifest push ${IMAGE}:${TAG} | |
- name: Push latest to tip tag. | |
if: github.ref == 'refs/heads/main' | |
run: | | |
TAG=${{ steps.meteroid-docker.outputs.version }} | |
IMAGE=ghcr.io/meteroid-oss/${{ matrix.image_type }} | |
docker manifest create ${IMAGE}:tip ${IMAGE}:arm64-${TAG} ${IMAGE}:amd64-${TAG} | |
docker manifest annotate ${IMAGE}:tip ${IMAGE}:arm64-${TAG} --arch arm64 | |
docker manifest annotate ${IMAGE}:tip ${IMAGE}:amd64-${TAG} --arch amd64 | |
docker manifest push ${IMAGE}:tip | |
- name: Push latest to latest tag. | |
if: github.event_name == 'release' | |
run: | | |
TAG=${{ steps.meteroid-docker.outputs.version }} | |
IMAGE=ghcr.io/meteroid-oss/${{ matrix.image_type }} | |
docker manifest create ${IMAGE}:latest ${IMAGE}:arm64-${TAG} ${IMAGE}:amd64-${TAG} | |
docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64-${TAG} --arch arm64 | |
docker manifest annotate ${IMAGE}:latest ${IMAGE}:amd64-${TAG} --arch amd64 | |
docker manifest push ${IMAGE}:latest |