From d36027969579ec9f15c32c72992f613b161e6edf Mon Sep 17 00:00:00 2001 From: saadi Date: Tue, 4 Apr 2023 10:26:38 +0200 Subject: [PATCH] Name all steps in CI and CD workflows --- .github/workflows/cd.yaml | 9 ++++++--- .github/workflows/ci.yaml | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 3bd3ae3..1b5dc16 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -12,15 +12,18 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }} steps: - - uses: google-github-actions/auth@v1 + - name: Authenticate with Google Cloud + uses: google-github-actions/auth@v1 with: credentials_json: '${{ secrets.GCP_SA_KEY }}' - - uses: google-github-actions/setup-gcloud@v1 + - name: Setup gcloud CLI + uses: google-github-actions/setup-gcloud@v1 with: project_id: ${{ secrets.GCP_PROJECT_ID }} - - run: | + - name: Deploy app to Cloud Run + run: | gcloud run deploy my-finance-pal \ --image=${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/cloud-run-source-deploy/my-finance-pal:${{ github.sha }} \ --allow-unauthenticated \ diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 79210c0..7ce2846 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,17 +11,22 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 with: node-version: '18' - - run: yarn install + - name: Install dependencies + run: yarn install - - run: yarn build + - name: Build application + run: yarn build - - run: yarn test + - name: Run tests + run: yarn test cloud_build: needs: build_and_test @@ -29,17 +34,21 @@ jobs: if: ${{ github.event_name == 'push' }} steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - uses: google-github-actions/auth@v1 + - name: Authenticate with Google Cloud + uses: google-github-actions/auth@v1 with: credentials_json: '${{ secrets.GCP_SA_KEY }}' - - uses: google-github-actions/setup-gcloud@v1 + - name: Setup gcloud CLI + uses: google-github-actions/setup-gcloud@v1 with: project_id: ${{ secrets.GCP_PROJECT_ID }} - - run: | + - name: Submit job to Cloud Build + run: | gcloud builds submit \ --region=${{ secrets.GCP_REGION }} \ --config cloudbuild.yaml \