Skip to content

Commit

Permalink
ci: handle env variables correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPietrusky committed Jul 24, 2024
1 parent 5095500 commit 4b85af2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}

Expand Down

0 comments on commit 4b85af2

Please sign in to comment.