diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml index f0d4d21..8b3c7bc 100644 --- a/.github/workflows/create-branch-images.yml +++ b/.github/workflows/create-branch-images.yml @@ -1,5 +1,4 @@ name: create-branch-images - on: workflow_call: workflow_dispatch: @@ -8,48 +7,31 @@ on: - 'dev' tags: - '**' - + jobs: - docker: + build-frontend: 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 - + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - + uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker + - name: Extract metadata for Frontend Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: - images: | - ghcr.io/${{ github.repository }}/frontend - ghcr.io/${{ github.repository }}/backend - ghcr.io/${{ github.repository }}/router + images: ghcr.io/${{ github.repository }}-frontend 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 + - name: Build and push Frontend Docker image + uses: docker/build-push-action@v5 with: context: ./client push: ${{ github.event_name != 'pull_request' }} @@ -59,8 +41,29 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - - name: Build and push backend Docker image - uses: docker/build-push-action@v3 + build-backend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata for Backend Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }}-backend + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + - name: Build and push Backend Docker image + uses: docker/build-push-action@v5 with: context: ./server push: ${{ github.event_name != 'pull_request' }} @@ -70,8 +73,29 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - - name: Build and push router Docker image - uses: docker/build-push-action@v3 + build-router: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata for Router Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }}-router + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + - name: Build and push Router Docker image + uses: docker/build-push-action@v5 with: context: ./nginx push: ${{ github.event_name != 'pull_request' }} @@ -79,4 +103,4 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: type=gha,mode=max \ No newline at end of file