From 293ba165a51a753a08e818e44442b84f1ce86116 Mon Sep 17 00:00:00 2001 From: Jacob McSwain Date: Sat, 10 Feb 2024 15:21:48 -0600 Subject: [PATCH] feat: Release to GHCR --- .github/workflows/ghcr.yml | 69 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 78 +++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 .github/workflows/ghcr.yml diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml new file mode 100644 index 000000000..f3cc7e921 --- /dev/null +++ b/.github/workflows/ghcr.yml @@ -0,0 +1,69 @@ +--- +name: GHCR Developer image +on: # yamllint disable-line rule:truthy + push: + branches: [main] + +jobs: + push-amd64: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Docker - Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker - Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: type=raw,value=dev + flavor: latest=false + + - name: Docker - Build / Push + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + + push-arm64: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker - Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker - Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: type=raw,value=dev-arm64 + flavor: latest=false + + - name: Docker - Build / Push + uses: docker/build-push-action@v5 + with: + file: Dockerfile.arm64 + platforms: linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd41022f3..af4141ccc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,6 +39,41 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} + # Builds the Dockerfile and pushes it to GHCR + release-ghcr-amd64: + name: Release - GHCR Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Docker - Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker - Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + # generate Docker tags based on the following events/attributes + tags: | + type=semver,pattern=v{{version}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} + flavor: latest=true + + - name: Docker - Build / Push + id: docker_build + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + # Builds the Dockerfile.arm64 and pushes it to dockerhub release-arm64: name: Release - Docker image @@ -81,6 +116,49 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} + # Builds the Dockerfile.arm64 and pushes it to GHCR + release-ghcr-arm64: + name: Release - GHCR Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker - Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker - Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + # generate Docker tags based on the following events/attributes + tags: | + type=semver,pattern=v{{version}}-arm64 + type=semver,pattern=v{{major}}.{{minor}}-arm64 + type=semver,pattern=v{{major}}-arm64 + type=raw,value=latest-arm64 + flavor: latest=false + + - name: Docker - Build / Push + id: docker_build + uses: docker/build-push-action@v5 + with: + file: Dockerfile.arm64 + platforms: linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + # Generates a new release specifically for the helm chart, using the helm charts version # Only generates a new release if the helm charts version has changed since the last release # Will then update the gh-pages branch & helm repository