From cf498a56d925757d7fa7587f69ab8d04d618f415 Mon Sep 17 00:00:00 2001 From: InsertDisc <31751462+InsertDisc@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:44:13 -0500 Subject: [PATCH] Update build-develop.yml Added ARM support and Docker Hub support. --- .github/workflows/build-develop.yml | 46 +++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 379a446..5a1b1f5 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -1,4 +1,5 @@ name: Build :develop + on: workflow_dispatch: push: @@ -13,20 +14,53 @@ on: types: [closed] jobs: - build: + build-and-push: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 with: - ref: develop + ref: main - name: Login to GitHub Container Registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - name: Build Docker image - run: docker build -t ghcr.io/insertdisc/pattrmm:develop . + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push to GitHub Container Registry + id: docker_build_push_ghcr + uses: docker/build-push-action@v5 + with: + context: ./ + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ghcr.io/insertdisc/pattrmm:develop + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Pull image from GitHub Container Registry + run: docker pull ghcr.io/insertdisc/pattrmm:develop + + - name: Tag for Docker Hub + run: | + docker tag ghcr.io/insertdisc/pattrmm:develop ${{ secrets.DOCKER_HUB_USERNAME }}/pattrmm:develop - - name: Push Docker image - run: docker push ghcr.io/insertdisc/pattrmm:develop + - name: Push to Docker Hub + run: | + docker push ${{ secrets.DOCKER_HUB_USERNAME }}/pattrmm:develop +