Merge pull request #60 from cheehongw/question-stdin-stdout #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Selectively Build and Push to Artifact Registry | |
on: | |
push: | |
branches: ["master"] | |
env: | |
PROJECT_ID: cs3219-400714 | |
REGION: asia-southeast1 | |
GAR_LOCATION: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/ | |
jobs: | |
build-push-artifact: | |
runs-on: ubuntu-latest | |
outputs: | |
build_status: ${{ steps.set_output.outputs.build_status }} | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v3" | |
- name: Detect Changes in Microservices | |
id: changes | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
frontend: | |
- 'frontend/**' | |
user_service: | |
- 'user_service/**' | |
question_service: | |
- 'question_service/**' | |
matching_service: | |
- 'user_service/**' | |
match_worker: | |
- 'match_worker/**' | |
collab_service: | |
- 'collab_service/**' | |
- name: 'Create env file' | |
run: | | |
echo "${{ secrets.ENV_FILE }}" > .env | |
- name: "Set up google auth" | |
id: auth | |
uses: "google-github-actions/auth@v1" | |
with: | |
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}" | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v1" | |
- name: "Use gcloud CLI" | |
run: "gcloud info" | |
- name: "Docker auth" | |
run: |- | |
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet | |
- name: Determine Build Status | |
id: set_output | |
run: echo "::set-output name=build_status::false" | |
- name: 1. Build and Push frontend | |
if: steps.changes.outputs.frontend == 'true' | |
run: | | |
docker-compose build frontend | |
docker-compose push frontend | |
echo "::set-output name=build_status::true" | |
- name: 2. Build and Push question-service | |
if: steps.changes.outputs.question_service == 'true' | |
run: | | |
docker-compose build question-service | |
docker-compose push question-service | |
echo "::set-output name=build_status::true" | |
- name: 3. Build and Push user-service | |
if: steps.changes.outputs.user_service == 'true' | |
run: | | |
docker-compose build user-service | |
docker-compose push user-service | |
echo "::set-output name=build_status::true" | |
- name: 4. Build and Push matching-service | |
if: steps.changes.outputs.matching_service == 'true' | |
run: | | |
docker-compose build matching-service | |
docker-compose push matching-service | |
echo "::set-output name=build_status::true" | |
- name: 5. Build and Push match-worker | |
if: steps.changes.outputs.match_worker == 'true' | |
run: | | |
docker-compose build match-worker | |
docker-compose push match-worker | |
echo "::set-output name=build_status::true" | |
- name: 6. Build and Push collab-service | |
if: steps.changes.outputs.collab_service == 'true' | |
run: | | |
docker-compose build collab-service | |
docker-compose push collab-service | |
echo "::set-output name=build_status::true" |