name: Deploy Cloud Function

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Set up Google Cloud SDK
        uses: google-github-actions/setup-gcloud@master
        with:
          service_account_key: ${{ secrets.GCP_SA_KEY }}
          project_id: showcase-function

      - name: Deploy Cloud Function
        run: gcloud functions deploy ExchangeTokenFunction --runtime nodejs20 --trigger-http --allow-unauthenticated
