2022-03-09 19:13:15 +01:00
|
|
|
name: Build snapshot
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- develop
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
GH_REPO: ghcr.io
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build-and-push-docker-image:
|
|
|
|
name: Build Docker snapshot
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
id: qemu
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
with:
|
|
|
|
image: tonistiigi/binfmt:latest
|
|
|
|
platforms: ${{ env.PLATFORMS }}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
2022-04-13 13:47:58 +02:00
|
|
|
- name: Log into ${{ env.GH_REPO }} registry
|
2022-03-09 19:13:15 +01:00
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ${{ env.GH_REPO }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-04-13 13:47:58 +02:00
|
|
|
|
|
|
|
- name: Log into DockerHub registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2022-03-09 19:13:15 +01:00
|
|
|
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
2022-04-13 13:47:58 +02:00
|
|
|
images: |
|
|
|
|
${{ env.GH_REPO }}/${{ env.IMAGE_NAME }}
|
|
|
|
${{ env.IMAGE_NAME }}
|
2022-03-09 19:13:15 +01:00
|
|
|
|
|
|
|
- name: Build image and push snapshot to GitHub Container Registry
|
|
|
|
id: build-and-push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: ${{ env.PLATFORMS }}
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|