From 680a8541512b2da14bf745bde6b9af34d43075f0 Mon Sep 17 00:00:00 2001 From: w13b3 Date: Sat, 6 Apr 2024 22:42:21 +0200 Subject: [PATCH] :building_construction: --- .github/workflows/publish-image.yml | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/publish-image.yml diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml new file mode 100644 index 0000000..5737324 --- /dev/null +++ b/.github/workflows/publish-image.yml @@ -0,0 +1,52 @@ +name: Publish image +on: + push: + branches: + - master + pull_request: + +env: + BUILD_DEBIAN_TAG: bookworm-20240311-slim + BUILD_TAG: ghcr.io/${{ github.repository_owner }}/redbean-build:${{ github.sha }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + if: ${{ github.event_name != 'pull_request' }} + steps: + - name: Checkout + uses: actions/checkout@v4.1.2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.2.0 + + - name: Log in to Docker Hub + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ secrets.GH_USR }} + password: ${{ secrets.GH_PAT }} + logout: true + + - name: Build and export build image + uses: docker/build-push-action@v5.3.0 + with: + load: true + push: false + context: . + file: ./Dockerfile.redbean-build + build-args: BUILD_DEBIAN_TAG=${{ env.BUILD_DEBIAN_TAG }} + tags: | + ${{ env.BUILD_TAG }} + + - name: Build and push final image + uses: docker/build-push-action@v5.3.0 + with: + push: true + context: . + file: ./Dockerfile.redbean-scratch + build-args: | + GIT_REPO_OWNER=${{ github.repository_owner }} + BUILD_TAG=${{ github.sha }} + tags: | + ghcr.io/${{ github.repository_owner }}/redbean:latest