Merge pull request #331 from alphagov/dependabot/npm_and_yarn/multi-0… #125
This file contains hidden or 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: Deploy Staging | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'signon-mock/**' | |
| - 'cypress/**' | |
| - 'cypress*' | |
| - 'jest*' | |
| - '.prettier*' | |
| - '.eslint*' | |
| - '.gitignore' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: staging | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Build Project | |
| run: npm run clean-build | |
| - name: Generate Tag | |
| id: generate_tag | |
| run: | | |
| echo "TAG=main-$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" | |
| - name: Setup Google Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v0.2.1 | |
| with: | |
| project_id: ${{ vars.GCP_PROJECT_ID }} | |
| service_account_key: ${{ secrets.GCP_SA_KEY }} | |
| export_default_credentials: true | |
| - name: Deploy to Cloud Run | |
| id: deploy | |
| run: | | |
| gcloud run deploy govuk-knowledge-graph-search \ | |
| --source . \ | |
| --region "europe-west2" \ | |
| --tag ${{ env.TAG }} \ | |
| --no-traffic \ | |
| --project ${{ vars.GCP_PROJECT_ID }} | |
| - name: Route Traffic to New Revision | |
| run: | | |
| gcloud run services update-traffic govuk-knowledge-graph-search \ | |
| --to-tags ${{ env.TAG }}=100 \ | |
| --region "europe-west2" \ | |
| --project ${{ vars.GCP_PROJECT_ID }} |