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' +