From d4889c4e3eaa9056f29b84c69483c3a56a6ac390 Mon Sep 17 00:00:00 2001 From: olemorud Date: Wed, 7 Dec 2022 18:39:33 +0100 Subject: [PATCH] add action to deploy cloud function --- .github/workflows/deploy.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1270052 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ + +name: 'Deploy Google Cloud Function' + +jobs: + deploy: + permissions: + contents: 'read' + id-token: 'write' + + steps: + - id: 'Checkout' + uses: 'actions/checkout@v3' + + - id: 'Google Cloud Authentication' + uses: 'google-github-actions/auth@v1' + with: + credentials_json: ${{ secrets.CLOUD_CREDENTIALS }} + + - id: 'Deploy Cloud Function' + uses: 'google-github-actions/deploy-cloud-functions@v1' + with: + description: 'Ping selected group of members on mattermost when coffee is mentioned' + name: 'coffee2' + runtime: 'go119' + memory_mb: 1 + region: 'europe-west1' + + - id: 'Test #1' + run: 'echo "This should fail (no token)"; "curl "${{ steps.deploy.outputs.url }}" || true' + + - id: 'Test #2' + run: 'echo "This should succeed"; "curl "${{ steps.deploy.outputs.url }}" || true' +