From 3ad2333a83e10010508f136419618ef4a49d83e7 Mon Sep 17 00:00:00 2001 From: Bravewave Date: Sun, 17 Nov 2024 03:56:40 +0000 Subject: [PATCH] god help us --- .github/workflows/build-deploy.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 32e9c57..9775abc 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -1,5 +1,9 @@ name: Build and Push Container Images +permissions: + contents: read + packages: write + on: push: branches: @@ -34,14 +38,19 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN}} - # 4. Build and push Frontend Docker image to GHCR + # 4. Set repository name to lowercase + - name: Set lowercase repository name + id: repo + run: echo "REPO_NAME=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' > $GITHUB_ENV + + # 5. Build and push Frontend Docker image to GHCR - name: Build Frontend Docker image run: | - docker build -t ghcr.io/jharworth21/hacksheffield-9/frontend:latest ./frontend - docker push ghcr.io/jharworth21/hacksheffield-9/frontend:latest + docker build -t ghcr.io/${{ env.REPO_NAME }}/frontend:latest ./frontend + docker push ghcr.io/${{ env.REPO_NAME }}/frontend:latest - # 5. Build and push Backend Docker image to GHCR + # 6. Build and push Backend Docker image to GHCR - name: Build Backend Docker image run: | - docker build -t ghcr.io/jharworth21/hacksheffield-9/backend:latest ./backend - docker push ghcr.io/jharworth21/hacksheffield-9/backend:latest \ No newline at end of file + docker build -t ghcr.io/${{ env.REPO_NAME }}/backend:latest ./backend + docker push ghcr.io/${{ env.REPO_NAME }}/backend:latest \ No newline at end of file