-
Notifications
You must be signed in to change notification settings - Fork 5
71 lines (56 loc) · 2.16 KB
/
Copy pathtest-devbox.yml
File metadata and controls
71 lines (56 loc) · 2.16 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Testing with devbox
on:
push:
branches:
- 157-offline-dev
permissions:
id-token: write
contents: read
env:
PROJECT_ID: 'benefit-decision-toolkit-play'
REGION: 'us-central1'
SERVICE: 'benefit-decision-toolkit-play'
API_NAME: 'builder-api'
WORKLOAD_IDENTITY_PROVIDER: 'projects/1034049717668/locations/global/workloadIdentityPools/github-actions-google-cloud/providers/github'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: cp .env.example .env
# run: |-
# echo "QUARKUS_GOOGLE_CLOUD_PROJECT_ID=${{ secrets.QUARKUS_GOOGLE_CLOUD_PROJECT_ID }}" >> .env
# instead of copying, we need to use gh secrets to create the .env file with the "real" values
# e.g:
# echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env
# echo "API_KEY=${{ secrets.API_KEY }}" >> .env
# Add other variables as needed
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.12.0
with:
enable-cache: true
# Configure Workload Identity Federation and generate an access token
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
service_account: cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
project_id: ${{ env.PROJECT_ID }}
- name: 'Use gcloud CLI via Devbox'
run: 'devbox run -- gcloud info'
- name: 'Config docker with devbox'
run: devbox run -- gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev
- name: 'Use gcloud CLI without Devbox'
run: 'gcloud info'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI without Devbox after setup action'
run: 'gcloud info'
# - name: Check devbox env variables
# run: devbox run -- env
# - name: Run a script called test
# run: devbox run setup
- name: Run arbitrary commands
run: devbox run -- echo "done!"