zerotier-docker/.github/workflows/router.yml

121 lines
5.7 KiB
YAML
Raw Normal View History

name: Router Mode build
2022-01-29 12:16:55 +01:00
on:
workflow_call:
inputs:
event:
required: true
type: string
tag:
required: true
type: string
secrets:
QUAY_PASSWORD:
required: true
REGISTRY_PASSWORD:
required: true
env:
IMAGE_NAME: zerotier
2022-07-28 14:48:15 +02:00
STORAGE_DRIVER: overlay
2022-01-29 12:16:55 +01:00
jobs:
build:
name: Build images
2022-06-13 08:01:35 +02:00
runs-on: ubuntu-22.04
2022-01-29 12:16:55 +01:00
strategy:
fail-fast: false
matrix:
platform: [
2022-06-12 23:11:47 +02:00
{name: "linux/amd64", tag: "amd64"},
{name: "linux/386", tag: "i386"},
{name: "linux/arm64/v8", tag: "arm64v8"},
{name: "linux/arm/v7", tag: "arm32v7"},
{name: "linux/arm/v6", tag: "arm32v6"},
2024-04-12 23:53:08 +02:00
{name: "linux/riscv64", tag: "riscv64"},
{name: "linux/ppc64le", tag: "ppc64le"},
{name: "linux/s390x", tag: "s390x"}
2022-01-29 12:16:55 +01:00
]
steps:
- name: Checkout zerotier-docker
2022-06-13 08:01:35 +02:00
uses: actions/checkout@v3
2022-01-29 12:16:55 +01:00
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build unstable image
if: ${{ inputs.event == 'push' }}
run: buildah bud --platform ${{ matrix.platform.name }} --build-arg FROM_IMAGE=${{ format('ghcr.io/zyclonite/{0}', env.IMAGE_NAME) }} --build-arg FROM_VERSION=main -f ./Dockerfile.router -t ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }} .
2022-01-29 12:16:55 +01:00
- name: Build stable image
if: ${{ inputs.event == 'release' }}
run: buildah bud --platform ${{ matrix.platform.name }} --build-arg FROM_IMAGE=${{ format('ghcr.io/zyclonite/{0}', env.IMAGE_NAME) }} --build-arg FROM_VERSION=${{ inputs.tag }} -f ./Dockerfile.router -t ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }} .
2022-01-29 12:16:55 +01:00
- name: Check images created
run: buildah images | grep '${{ env.IMAGE_NAME }}'
- name: Check image metadata
2022-06-14 10:13:17 +02:00
run: buildah inspect ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }} | jq ".OCIv1.architecture"
2022-01-29 12:16:55 +01:00
- name: Export image
2022-06-12 23:11:47 +02:00
run: podman save -o /tmp/image.tar ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }}
2022-01-29 12:16:55 +01:00
- name: Upload artifact
2022-10-17 18:47:45 +02:00
uses: actions/upload-artifact@v3
2022-01-29 12:16:55 +01:00
with:
2022-06-12 23:11:47 +02:00
name: image-${{ matrix.platform.tag }}
2022-01-29 12:16:55 +01:00
path: /tmp/image.tar
push:
name: Publish images
2022-06-13 08:01:35 +02:00
runs-on: ubuntu-22.04
2022-01-29 12:16:55 +01:00
needs: build
environment: production
steps:
- name: Download artifacts
2022-10-17 18:47:45 +02:00
uses: actions/download-artifact@v3
2022-01-29 12:16:55 +01:00
2022-06-21 16:56:05 +02:00
- name: Setup podman and buildah
uses: zyclonite/setup-podman@v1
2022-01-29 12:16:55 +01:00
- 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
2024-04-12 23:53:08 +02:00
podman load -i ./image-ppc64le/image.tar
podman load -i ./image-s390x/image.tar
2022-01-29 12:16:55 +01:00
- name: Create multi-arch manifest
run: |
buildah manifest create ${{ env.IMAGE_NAME }}:latest
2022-06-12 23:11:47 +02:00
buildah manifest add --arch amd64 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:amd64
buildah manifest add --arch 386 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:i386
buildah manifest add --arch arm64 --variant v8 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm64v8
buildah manifest add --arch arm --variant v7 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm32v7
buildah manifest add --arch arm --variant v6 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm32v6
buildah manifest add --arch riscv64 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:riscv64
2024-04-12 23:53:08 +02:00
buildah manifest add --arch ppc64le ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:ppc64le
buildah manifest add --arch s390x ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:s390x
2022-01-29 12:16:55 +01:00
- name: Push unstable images
if: ${{ inputs.event == 'push' }}
run: |
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/zyclonite/${{ env.IMAGE_NAME }}:router-main
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/zyclonite/${{ env.IMAGE_NAME }}:router-main
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/zyclonite/${{ env.IMAGE_NAME }}:router-main
2022-01-29 12:16:55 +01:00
- name: Push stable images
if: ${{ inputs.event == 'release' }}
run: |
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/zyclonite/${{ env.IMAGE_NAME }}:router
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/zyclonite/${{ env.IMAGE_NAME }}:router-${{ github.event.release.tag_name }}
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/zyclonite/${{ env.IMAGE_NAME }}:router
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/zyclonite/${{ env.IMAGE_NAME }}:router-${{ github.event.release.tag_name }}
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/zyclonite/${{ env.IMAGE_NAME }}:router
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/zyclonite/${{ env.IMAGE_NAME }}:router-${{ github.event.release.tag_name }}