2021-08-17 22:31:47 +02:00
|
|
|
name: Multiarch build
|
|
|
|
on:
|
|
|
|
push:
|
2021-08-18 13:53:26 +02:00
|
|
|
branches:
|
|
|
|
- main
|
2021-08-17 22:31:47 +02:00
|
|
|
pull_request:
|
2021-08-18 13:53:26 +02:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- created
|
2021-08-17 22:31:47 +02:00
|
|
|
|
|
|
|
env:
|
|
|
|
IMAGE_NAME: zerotier
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build images
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-01-29 12:16:55 +01:00
|
|
|
platform: [
|
|
|
|
{os: "linux", arch: "amd64", variant: "", name: "amd64"},
|
|
|
|
{os: "linux", arch: "386", variant: "", name: "i386"},
|
|
|
|
{os: "linux", arch: "arm64", variant: "v8", name: "arm64v8"},
|
|
|
|
{os: "linux", arch: "arm", variant: "v7", name: "arm32v7"},
|
2022-01-31 09:38:09 +01:00
|
|
|
{os: "linux", arch: "arm", variant: "v6", name: "arm32v6"},
|
|
|
|
{os: "linux", arch: "riscv64", variant: "", name: "riscv64"}
|
2022-01-29 12:16:55 +01:00
|
|
|
]
|
2021-08-17 22:31:47 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout zerotier-docker
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install qemu dependency
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y qemu-user-static
|
|
|
|
|
|
|
|
- name: Build Image
|
|
|
|
uses: redhat-actions/buildah-build@v2
|
|
|
|
with:
|
|
|
|
image: ${{ env.IMAGE_NAME }}
|
2022-01-29 12:16:55 +01:00
|
|
|
tags: ${{ matrix.platform.name }}
|
|
|
|
platform: ${{ format('{0}/{1}/{2}', matrix.platform.os, matrix.platform.arch, matrix.platform.variant) }}
|
2021-08-17 22:31:47 +02:00
|
|
|
build-args: |
|
2022-01-31 09:38:09 +01:00
|
|
|
ALPINE_IMAGE=docker.io/alpine
|
2021-08-17 22:31:47 +02:00
|
|
|
dockerfiles: |
|
|
|
|
./Dockerfile
|
|
|
|
|
|
|
|
- name: Check images created
|
|
|
|
run: buildah images | grep '${{ env.IMAGE_NAME }}'
|
|
|
|
|
|
|
|
- name: Check image metadata
|
|
|
|
run: |
|
|
|
|
set -x
|
2022-01-29 12:16:55 +01:00
|
|
|
buildah inspect ${{ env.IMAGE_NAME }}:${{ matrix.platform.name }} | jq ".OCIv1.architecture"
|
|
|
|
buildah inspect ${{ env.IMAGE_NAME }}:${{ matrix.platform.name }} | jq ".Docker.architecture"
|
2021-08-17 22:31:47 +02:00
|
|
|
|
|
|
|
- name: Export image
|
2022-01-29 12:16:55 +01:00
|
|
|
run: podman save -o /tmp/image.tar ${{ env.IMAGE_NAME }}:${{ matrix.platform.name }}
|
2021-08-17 22:31:47 +02:00
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-01-29 12:16:55 +01:00
|
|
|
name: image-${{ matrix.platform.name }}
|
2021-08-17 22:31:47 +02:00
|
|
|
path: /tmp/image.tar
|
|
|
|
|
|
|
|
push:
|
|
|
|
name: Publish images
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
environment: production
|
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
|
|
|
|
- name: Import images
|
|
|
|
run: |
|
|
|
|
podman load -i ./image-amd64/image.tar
|
|
|
|
podman load -i ./image-i386/image.tar
|
|
|
|
podman load -i ./image-arm64v8/image.tar
|
|
|
|
podman load -i ./image-arm32v7/image.tar
|
|
|
|
podman load -i ./image-arm32v6/image.tar
|
2022-01-31 09:38:09 +01:00
|
|
|
podman load -i ./image-riscv64/image.tar
|
2021-08-17 22:31:47 +02:00
|
|
|
|
|
|
|
- name: Create multi-arch manifest
|
|
|
|
run: |
|
|
|
|
buildah manifest create ${{ env.IMAGE_NAME }}:latest
|
2022-06-12 21:50:15 +02:00
|
|
|
buildah manifest add ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:amd64
|
|
|
|
buildah manifest add ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:i386
|
|
|
|
buildah manifest add ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm64v8
|
|
|
|
buildah manifest add ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm32v7
|
|
|
|
buildah manifest add ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm32v6
|
|
|
|
buildah manifest add ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:riscv64
|
2021-08-17 22:31:47 +02:00
|
|
|
|
2021-08-18 13:53:26 +02:00
|
|
|
- name: Push unstable images
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
2021-08-17 22:31:47 +02:00
|
|
|
run: |
|
2021-08-18 13:53:26 +02:00
|
|
|
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/zyclonite/${{ env.IMAGE_NAME }}:main
|
2021-08-25 14:30:45 +02:00
|
|
|
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/zyclonite/${{ env.IMAGE_NAME }}:main
|
2022-01-05 17:35:04 +01:00
|
|
|
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/zyclonite/${{ env.IMAGE_NAME }}:main
|
2021-08-18 13:53:26 +02:00
|
|
|
|
|
|
|
- name: Push stable images
|
|
|
|
if: ${{ github.event_name == 'release' }}
|
|
|
|
run: |
|
|
|
|
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/zyclonite/${{ env.IMAGE_NAME }}:latest
|
2021-08-18 15:38:18 +02:00
|
|
|
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/zyclonite/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
|
2021-08-25 14:30:45 +02:00
|
|
|
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/zyclonite/${{ env.IMAGE_NAME }}:latest
|
|
|
|
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/zyclonite/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
|
2022-01-05 17:35:04 +01:00
|
|
|
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/zyclonite/${{ env.IMAGE_NAME }}:latest
|
|
|
|
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/zyclonite/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
|
2022-01-29 12:16:55 +01:00
|
|
|
|
|
|
|
bridge:
|
|
|
|
uses: ./.github/workflows/bridge.yml
|
|
|
|
needs: push
|
|
|
|
with:
|
|
|
|
tag: ${{ github.event.release.tag_name }}
|
|
|
|
event: ${{ github.event_name }}
|
|
|
|
secrets:
|
|
|
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
|