upgrade to 22.0.1 #61
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-server | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- created | |
env: | |
IMAGE_OWNER: noenv | |
IMAGE_NAME: openjdk | |
STORAGE_DRIVER: overlay | |
jobs: | |
build: | |
name: Build images | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ | |
{name: "linux/amd64", tag: "amd64"}, | |
{name: "linux/arm64/v8", tag: "arm64v8"} | |
] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install qemu dependency | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- name: Build Image | |
run: buildah bud --platform ${{ matrix.platform.name }} -f ./Dockerfile.server -t ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }} . | |
- name: Check images created | |
run: buildah images | grep '${{ env.IMAGE_NAME }}' | |
- name: Check image metadata | |
run: buildah inspect ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }} | jq ".OCIv1.architecture" | |
- name: Export image | |
run: podman save -o /tmp/image.tar ${{ env.IMAGE_NAME }}:${{ matrix.platform.tag }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: image-${{ matrix.platform.tag }} | |
path: /tmp/image.tar | |
push: | |
name: Publish images | |
runs-on: ubuntu-22.04 | |
needs: build | |
environment: production | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Setup podman and buildah | |
uses: zyclonite/setup-podman@v1 | |
- name: Import images | |
run: | | |
podman load -i ./image-amd64/image.tar | |
podman load -i ./image-arm64v8/image.tar | |
- name: Create multi-arch manifest | |
run: | | |
buildah manifest create ${{ env.IMAGE_NAME }}:latest | |
buildah manifest add --arch amd64 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:amd64 | |
buildah manifest add --arch arm64 --variant v8 ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:arm64v8 | |
- name: Push unstable images | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:main-server | |
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:main-server | |
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:main-server | |
- 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/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:server | |
buildah manifest push --all --format v2s2 --creds zyclonite:${{ secrets.REGISTRY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://docker.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-server | |
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:server | |
buildah manifest push --all --creds zyclonite:${{ secrets.QUAY_PASSWORD }} ${{ env.IMAGE_NAME }}:latest docker://quay.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-server | |
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:server | |
buildah manifest push --all --creds zyclonite:${{ secrets.GITHUB_TOKEN }} ${{ env.IMAGE_NAME }}:latest docker://ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-server |