mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-08-21 08:29:23 +00:00
108 lines
3.5 KiB
YAML
108 lines
3.5 KiB
YAML
name: deploy-cloudrun credentials Integration
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'deploy-cloudrun/**'
|
|
- '.github/workflows/deploy-cloudrun-credentials-it.yml'
|
|
|
|
jobs:
|
|
gcloud:
|
|
name: with setup-gcloud
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: service
|
|
run: echo ::set-output name=service::run-gcloud-$GITHUB_SHA
|
|
- uses: actions/checkout@v2
|
|
- uses: google-github-actions/setup-gcloud@master # Set up ADC to make authenticated request to service
|
|
with:
|
|
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
|
export_default_credentials: true
|
|
- id: deploy
|
|
uses: ./deploy-cloudrun
|
|
with:
|
|
image: gcr.io/cloudrun/hello
|
|
service: ${{ steps.service.outputs.service }}
|
|
- uses: actions/setup-node@master
|
|
with:
|
|
node-version: 12.x
|
|
- run: npm install
|
|
working-directory: ./deploy-cloudrun
|
|
- name: Integration Tests
|
|
run: npm run e2e-tests
|
|
working-directory: ./deploy-cloudrun
|
|
env:
|
|
URL: ${{ steps.deploy.outputs.url }}
|
|
|
|
b64_json:
|
|
name: with base64 json creds
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: service
|
|
run: echo ::set-output name=service::run-b64-$GITHUB_SHA
|
|
- uses: actions/checkout@v2
|
|
- id: deploy
|
|
uses: ./deploy-cloudrun
|
|
with:
|
|
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
|
image: gcr.io/cloudrun/hello
|
|
service: ${{ steps.service.outputs.service }}
|
|
- uses: actions/setup-node@master
|
|
with:
|
|
node-version: 12.x
|
|
- run: npm install
|
|
working-directory: ./deploy-cloudrun
|
|
- uses: google-github-actions/setup-gcloud@master # Set up ADC to make authenticated request to service
|
|
with:
|
|
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
|
export_default_credentials: true
|
|
- name: Integration Tests
|
|
run: npm run e2e-tests
|
|
working-directory: ./deploy-cloudrun
|
|
env:
|
|
URL: ${{ steps.deploy.outputs.url }}
|
|
|
|
json:
|
|
name: with json creds
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: service
|
|
run: echo ::set-output name=service::run-json-$GITHUB_SHA
|
|
- uses: actions/checkout@v2
|
|
- id: deploy
|
|
uses: ./deploy-cloudrun
|
|
with:
|
|
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_JSON }}
|
|
image: gcr.io/cloudrun/hello
|
|
service: ${{ steps.service.outputs.service }}
|
|
- uses: actions/setup-node@master
|
|
with:
|
|
node-version: 12.x
|
|
- run: npm install
|
|
working-directory: ./deploy-cloudrun
|
|
- uses: google-github-actions/setup-gcloud@master # Set up ADC to make authenticated request to service
|
|
with:
|
|
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
|
export_default_credentials: true
|
|
- name: Integration Tests
|
|
run: npm run e2e-tests
|
|
working-directory: ./deploy-cloudrun
|
|
env:
|
|
URL: ${{ steps.deploy.outputs.url }}
|
|
|
|
cleanup:
|
|
name: Clean Up
|
|
runs-on: ubuntu-latest
|
|
needs: [json, gcloud, b64_json]
|
|
steps:
|
|
- uses: google-github-actions/setup-gcloud@master
|
|
with:
|
|
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
|
project_id: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
|
- name: Delete services
|
|
run: |-
|
|
gcloud config set run/platform managed
|
|
gcloud config set run/region us-central1
|
|
gcloud run services delete run-json-$GITHUB_SHA --quiet
|
|
gcloud run services delete run-b64-$GITHUB_SHA --quiet
|
|
gcloud run services delete run-gcloud-$GITHUB_SHA --quiet
|