baru ada go 122 #2
This file contains 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: Google Cloud Function Deployment | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: GCP Authentication | |
id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- name: Debug GCP credentials | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
run: | | |
echo "$GOOGLE_APPLICATION_CREDENTIALS" > credentials.json | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: 'Use gcloud CLI' | |
run: 'gcloud info' | |
- name: 'Deploy a gen 2 cloud function' | |
run: | | |
gcloud functions deploy petabackend \ | |
--region=asia-southeast2 \ | |
--allow-unauthenticated \ | |
--entry-point=WebHook \ | |
--gen2 \ | |
--runtime=go122 \ | |
--trigger-http \ | |
--timeout=540s \ | |
--set-env-vars MONGOSTRING='${{ secrets.MONGOSTRING }}',PHONENUMBER='${{ secrets.PHONENUMBER }}',GH_ACCESS_TOKEN='${{ secrets.GH_ACCESS_TOKEN }}',PRKEY='${{ secrets.PRKEY }}',AESKEY='${{ secrets.AESKEY }}' | |
- name: 'Cek eksistensi fungsi' | |
run: 'gcloud functions describe petabackend --region=asia-southeast2' | |
- name: 'Cek log debugging' | |
run: 'gcloud functions logs read petabackend --region=asia-southeast2' | |
- name: 'Cleaning Artifact Registry' | |
run: 'gcloud artifacts repositories delete gcf-artifacts --location=asia-southeast2 --quiet' |