From 4b85af2582ec76aeb74770b03f189adffbf50031 Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Wed, 24 Jul 2024 22:55:58 +0200 Subject: [PATCH] ci: handle env variables correctly --- .github/workflows/dev.yml | 25 ++++++------------------- docker-bake.hcl | 5 +++++ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 4009bb5..28d732c 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -9,6 +9,12 @@ on: jobs: dev: runs-on: ubuntu-latest-m + env: + DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }} + DOCKERHUB_IMG: ${{ secrets.DOCKERHUB_IMG }} + HUGGINGFACE_ACCESS_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }} + RELEASE_VERSION: ${{ github.ref_name }} + steps: - name: Checkout uses: actions/checkout@v3 @@ -40,27 +46,8 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set environment variables - run: | - echo "DOCKERHUB_REPO=${{ secrets.DOCKERHUB_REPO }}" >> $GITHUB_ENV - echo "DOCKERHUB_IMG=${{ secrets.DOCKERHUB_IMG }}" >> $GITHUB_ENV - echo "HUGGINGFACE_ACCESS_TOKEN=${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}" >> $GITHUB_ENV - echo "RELEASE_VERSION=${GITHUB_REF##refs/heads/}" | sed 's/\//-/g' >> $GITHUB_ENV - - name: Build and push the images uses: docker/bake-action@v2 with: push: true targets: sd3 - set: | - base.args.DOCKERHUB_REPO=${{ env.DOCKERHUB_REPO }} - base.args.DOCKERHUB_IMG=${{ env.DOCKERHUB_IMG }} - base.args.RELEASE_VERSION=${{ env.RELEASE_VERSION }} - sdxl.args.DOCKERHUB_REPO=${{ env.DOCKERHUB_REPO }} - sdxl.args.DOCKERHUB_IMG=${{ env.DOCKERHUB_IMG }} - sdxl.args.RELEASE_VERSION=${{ env.RELEASE_VERSION }} - sd3.args.HUGGINGFACE_ACCESS_TOKEN=${{ env.HUGGINGFACE_ACCESS_TOKEN }} - sd3.args.DOCKERHUB_REPO=${{ env.DOCKERHUB_REPO }} - sd3.args.DOCKERHUB_IMG=${{ env.DOCKERHUB_IMG }} - sd3.args.RELEASE_VERSION=${{ env.RELEASE_VERSION }} - sd3.tags=${{ env.DOCKERHUB_REPO }}/${{ env.DOCKERHUB_IMG }}:${{ env.RELEASE_VERSION }}-sd3 diff --git a/docker-bake.hcl b/docker-bake.hcl index 99d06fd..a9b2f26 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -22,6 +22,11 @@ target "base" { context = "." dockerfile = "Dockerfile" target = "base" + args = { + DOCKERHUB_REPO = "${DOCKERHUB_REPO}" + DOCKERHUB_IMG = "${DOCKERHUB_IMG}" + RELEASE_VERSION = "${RELEASE_VERSION}" + } tags = ["${DOCKERHUB_REPO}/${DOCKERHUB_IMG}:${RELEASE_VERSION}-base"] }