[CI] Build PR images on GHCR #6
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 GHCR images | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: [ "master" ] | |
env: | |
REGISTRY_IMAGE: ghcr.io/teslamate-org/teslamate | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
teslamate_build: | |
name: Build images | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: "linux/amd64" | |
runs_on: "ubuntu-latest" | |
cache_id: amd64 | |
- platform: "linux/arm/v7" | |
runs_on: "buildjet-2vcpu-ubuntu-2204-arm" | |
cache_id: arm | |
- platform: "linux/arm64" | |
runs_on: "buildjet-2vcpu-ubuntu-2204-arm" | |
cache_id: arm64 | |
runs-on: ${{ matrix.runs_on }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Buildx | |
uses: ./.github/actions/build | |
with: | |
docker_password: ${{ secrets.DOCKER_PASSWORD }} | |
repository_owner: ${{ github.repository_owner }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
labels: | | |
org.opencontainers.image.version=${{ github.ref || github.ref_name }} | |
teslamate_merge: | |
name: Merge GHCR images | |
runs-on: ubuntu-latest | |
needs: | |
- teslamate_build | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Merge | |
id: merge | |
uses: ./.github/actions/merge | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest list and push | |
working-directory: /tmp/teslamate/digests | |
run: | | |
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:$(cat /tmp/teslamate/version) \ | |
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:$(cat /tmp/teslamate/version) |