Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

feat(ci): allow to build only part of the images #19

feat(ci): allow to build only part of the images

feat(ci): allow to build only part of the images #19

name: Build and Push
on:
workflow_dispatch:
inputs:
build-choice:
type: choice
description: "Select which containers to build and push to GitHub Container Registry."
required: true
options:
- [All]
- frontend
- api
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Save Choice
run: |

Check failure on line 20 in .github/workflows/build-and-push.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-and-push.yml

Invalid workflow file

You have an error in your yaml syntax on line 20
BUILD_CHOICE_VALUE="${{ github.event.inputs.build-choice }}"
if [[ -z "$BUILD_CHOICE_VALUE" ]]; then
BUILD_CHOICE_VALUE="[All]"
fi
echo "ci_choice=$BUILD_CHOICE_VALUE" >> $GITHUB_ENV
echo "Received choice: $BUILD_CHOICE_VALUE"
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Build images with Docker Compose
run: docker-compose -f docker-compose.ci.yml build
- name: Tag and Push Frontend Image
run: |
docker tag taral_frontend:latest ghcr.io/${{ github.repository_owner }}/taral_frontend:latest
docker push ghcr.io/${{ github.repository_owner }}/taral_frontend:latest
- name: Tag and Push Backend Image
run: |
docker tag taral_api:latest ghcr.io/${{ github.repository_owner }}/taral_api:latest
docker push ghcr.io/${{ github.repository_owner }}/taral_api:latest
- name: Push Images
run: |
if [ "${{ env.ci_choice }}" == "[All]" ] || [ "${{ env.ci_choice }}" == "frontend" ]; then
echo \"Pushing taral_frontend\"
docker tag taral_frontend:latest ghcr.io/${{ github.repository_owner }}/taral_frontend:latest
docker push ghcr.io/${{ github.repository_owner }}/taral_frontend:latest
fi
if [ "${{ env.ci_choice }}" == "[All]" ] || [ "${{ env.ci_choice }}" == "api" ]; then
echo \"Pushing taral_api\"
docker tag taral_api:latest ghcr.io/${{ github.repository_owner }}/taral_api:latest
docker push ghcr.io/${{ github.repository_owner }}/taral_api:latest
fi