diff --git a/composite-actions/frontend-generic/prod-cloud-deploy/action.yaml b/composite-actions/frontend-generic/prod-cloud-deploy/action.yaml index f48a23a..f98032b 100644 --- a/composite-actions/frontend-generic/prod-cloud-deploy/action.yaml +++ b/composite-actions/frontend-generic/prod-cloud-deploy/action.yaml @@ -1,45 +1,57 @@ -name: "Cloud deploy prod" -description: "Cloud deploy prod" +name: 'Cloud deploy prod' +description: 'Cloud deploy prod' inputs: SECRET_AUTH: - description: "GCP Auth" + description: 'GCP Auth' required: true GCLOUD_AUTH_STAGING: - description: "GCP Auth (staging)" + description: 'GCP Auth (staging)' required: true GCLOUD_AUTH_PROD: - description: "GCP Auth (prod)" + description: 'GCP Auth (prod)' required: true GITHUB_TOKEN: - description: "GH token to create a release" + description: 'GH token to create a release' LD_CLIENT_ID: - description: "LaunchDarkly client ID in Secret Manager" + description: 'LaunchDarkly client ID in Secret Manager' required: true IMAGE: - description: "Image name for the service (without tag)" + description: 'Image name for the service (without tag)' required: true DEPLOY_TO_STAGE: - description: "Deploy to staging" + description: 'Deploy to staging' required: false RUN_E2E_TESTS: - description: "Run e2e tests" + description: 'Run e2e tests' required: false BUILD_TOOL: - description: "Build tool" + description: 'Build tool' required: false + GAR_WORKFLOW: + description: 'Use GAR auth workflow (true/false)' + required: false + default: 'false' runs: - using: "composite" + using: 'composite' steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Auth to Nexus npm registry + if: inputs.GAR_WORKFLOW != 'true' uses: extenda/actions/nexus-auth-npm@v0 with: service-account-key: ${{ inputs.SECRET_AUTH }} + - name: Auth to GCP + if: inputs.GAR_WORKFLOW == 'true' + uses: extenda/actions/setup-gcloud@v0 + with: + service-account-key: ${{ inputs.SECRET_AUTH }} + export-default-credentials: 'true' + - uses: extenda/actions/setup-gcloud@v0 id: gcloud with: @@ -51,6 +63,13 @@ runs: secrets: | LD_CLIENT_ID: ${{ inputs.LD_CLIENT_ID }} + - name: Run NPM auth script + if: inputs.GAR_WORKFLOW == 'true' + shell: bash + run: | + echo "@hiiretail:registry=https://europe-west1-npm.pkg.dev/extenda/npm/" > .npmrc + npm run auth -- --credential-config=./.npmrc + - name: Build and push Docker shell: bash run: | @@ -127,4 +146,4 @@ runs: secrets-account-key: ${{ inputs.SECRET_AUTH }} service-account-key: ${{ inputs.GCLOUD_AUTH_PROD }} update-dns: always - image: ${{ inputs.image }}:${{ steps.semver.outputs.release-tag }} + image: ${{ inputs.image }}:${{ steps.semver.outputs.release-tag }} \ No newline at end of file