From 77a2e010990d321d3d3becb4f7577f78de44637a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roch=C3=A9=20Compaan?= Date: Thu, 15 Feb 2024 11:40:16 +0200 Subject: [PATCH] feat: run scaf using IMAGE_TAG environment variable --- .github/workflows/setup-project.yaml | 20 ++++++++++++++++++++ scaf | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/setup-project.yaml b/.github/workflows/setup-project.yaml index eb7c5d93..6bf46d2d 100644 --- a/.github/workflows/setup-project.yaml +++ b/.github/workflows/setup-project.yaml @@ -3,7 +3,26 @@ name: Create scaf project on: [push, pull_request] jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + push: true + tags: sixfeetup/scaf:${{ env.GITHUB_SHA }} + setup: + needs: build-and-push runs-on: ${{ matrix.os }} strategy: matrix: @@ -18,5 +37,6 @@ jobs: - name: Create Project with Scaf shell: bash run: | + IMAGE_TAG=$GITHUB_SHA /usr/local/bin/scaf myproject --no-input diff --git a/scaf b/scaf index 3001cb9b..3aba259f 100755 --- a/scaf +++ b/scaf @@ -37,11 +37,11 @@ else COOKIECUTTER_OPTIONS="" fi -# Run docker with the specified options +IMAGE_TAG=${IMAGE_TAG:-latest} docker run --rm -it -v "$(pwd):/home/scaf/out" \ -e HOST_UID="$(id -u)" \ -e HOST_GID="$(id -g)" \ - sixfeetup/scaf:latest \ + sixfeetup/scaf:$IMAGE_TAG \ cookiecutter \ $COOKIECUTTER_OPTIONS \ $REPO_URL \