From 3b36b9e4e2537e54bb146e9803ceae4fdcbf6e14 Mon Sep 17 00:00:00 2001 From: Gabriel Moisan Matte Date: Tue, 17 Sep 2024 22:45:54 -0400 Subject: [PATCH 1/3] Create create-branch-images.yml --- .github/workflows/create-branch-images.yml | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/create-branch-images.yml diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml new file mode 100644 index 0000000..e928ab5 --- /dev/null +++ b/.github/workflows/create-branch-images.yml @@ -0,0 +1,82 @@ +name: create-branch-images + +on: + workflow_call: + workflow_dispatch: + push: + branches: + - '**' + tags: + - '**' + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/${{ github.repository }}/frontend + ghcr.io/${{ github.repository }}/backend + ghcr.io/${{ github.repository }}/router + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + - name: Build and push frontend Docker image + uses: docker/build-push-action@v3 + with: + context: ./client + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push backend Docker image + uses: docker/build-push-action@v3 + with: + context: ./server + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push router Docker image + uses: docker/build-push-action@v3 + with: + context: ./nginx + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From 3195a7a4a9bec97f479b87688fdf351266111874 Mon Sep 17 00:00:00 2001 From: gab9281 Date: Wed, 18 Sep 2024 16:36:19 -0400 Subject: [PATCH 2/3] removes instant branch image making --- .github/workflows/create-branch-images.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml index e928ab5..4be6469 100644 --- a/.github/workflows/create-branch-images.yml +++ b/.github/workflows/create-branch-images.yml @@ -4,8 +4,6 @@ on: workflow_call: workflow_dispatch: push: - branches: - - '**' tags: - '**' From 023476dd0b5284aa06c5041a51cd8f9c04dfdfea Mon Sep 17 00:00:00 2001 From: gab9281 Date: Wed, 18 Sep 2024 16:36:40 -0400 Subject: [PATCH 3/3] adds back preprod and staging --- .github/workflows/create-branch-images.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml index 4be6469..4a0ea1d 100644 --- a/.github/workflows/create-branch-images.yml +++ b/.github/workflows/create-branch-images.yml @@ -4,9 +4,12 @@ on: workflow_call: workflow_dispatch: push: + branches: + - 'main' + - 'dev' tags: - '**' - + jobs: docker: runs-on: ubuntu-latest