From c68ec787c1fb005e4aa4179e4e447057fd60f64f Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Tue, 1 Aug 2023 21:20:25 +0800 Subject: [PATCH] update workflow for dynamic use `_GITHUB_AUTH_TOKEN` to generate composer auth, and .npmrc for private repo access in builds --- .github/workflows/cd.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 36ca060c..c5999db6 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -10,7 +10,7 @@ concurrency: env: PROJECT: ${{ secrets.PROJECT }} - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_GITHUB_AUTH_TOKEN }}"}}' + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets._GITHUB_AUTH_TOKEN }}"}}' jobs: build_service: @@ -51,7 +51,7 @@ jobs: env: REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }} VERSION: ${{ env.VERSION }} - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_GITHUB_AUTH_TOKEN }}"}}' + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets._GITHUB_AUTH_TOKEN }}"}}' with: push: true files: | @@ -131,6 +131,13 @@ jobs: restore-keys: | ${{ runner.os }}-pnpm-store- + - name: Check for _GITHUB_AUTH_TOKEN and create .npmrc + run: | + if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then + echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc + fi + working-directory: ./console + - name: Install dependencies run: pnpm install working-directory: ./console @@ -141,7 +148,6 @@ jobs: pnpm build working-directory: ./console - - name: Deploy Console 🚀 run: |