Merge pull request #30 from Archisman-Mridha/hetzner-failover-script #1
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 push Hetzner Failover Script containers | |
on: | |
push: | |
branches: ["*"] | |
paths: ["hetzner-failover-script/**"] | |
tags: ["v*"] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Generate container metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ghcr.io/obmondo/hetzner-failover-script | |
tags: | | |
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }} | |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | |
type=ref,event=tag | |
flavor: | | |
latest=false | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & push container image | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
file: "./hetzner-failover-script/build/Dockerfile" | |
# NOTE : It takes pretty long to build container images for the ARM64 platform (even when | |
# using QEMU). | |
platforms: linux/amd64,linux/arm64 | |
context: ./hetzner-failover-script | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} |