-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (46 loc) · 2.01 KB
/
deploy.yml
File metadata and controls
57 lines (46 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Deploy to Cloud Run
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: Build
run: go build -v ./...
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v4
- id: "auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: "projects/${{ secrets.PROJECT_NUMBER }}/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
service_account: "github-actions@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Configure Docker
run: gcloud auth configure-docker europe-west3-docker.pkg.dev
- name: Build and Push Docker image
run: |
docker build -t europe-west3-docker.pkg.dev/${{ secrets.PROJECT_ID }}/cloud-run/fastspring-slack-bridge:${{ github.sha }} .
docker push europe-west3-docker.pkg.dev/${{ secrets.PROJECT_ID }}/cloud-run/fastspring-slack-bridge:${{ github.sha }}
- name: Deploy to Cloud Run
run: |
gcloud run deploy fastspring-slack-bridge \
--image europe-west3-docker.pkg.dev/${{ secrets.PROJECT_ID }}/cloud-run/fastspring-slack-bridge:${{ github.sha }} \
--platform managed \
--region europe-west3 \
--project ${{ secrets.PROJECT_ID }} \
--allow-unauthenticated \
--set-secrets "SLACK_WEBHOOK_URL=fastspring-slack-webhook:latest,FASTSPRING_HMAC_SECRET=fastspring-hmac-secret:latest,FASTSPRING_API_USERNAME=fastspring-api-username:latest,FASTSPRING_API_PASSWORD=fastspring-api-password:latest,SLACK_BOT_TOKEN=slack-bot-token:latest,SLACK_CHANNEL_ID=slack-channel-id:latest"