-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (91 loc) · 2.86 KB
/
apps-docs.yaml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Apps / Docs
on:
pull_request:
branches: ["*"]
paths:
- apps/docs/**
- packages/ui/**
- .github/workflows/apps-docs.yaml
- pnpm-lock.yaml
push:
branches: ["main"]
paths:
- apps/docs/**
- packages/ui/**
- .github/workflows/apps-docs.yaml
- pnpm-lock.yaml
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: "google-github-actions/auth@v2"
id: auth
with:
token_format: access_token
project_id: ctrlplane-prod
service_account: [email protected]
workload_identity_provider: "projects/591038869087/locations/global/workloadIdentityPools/github/providers/github"
- name: Login to GCR
uses: docker/login-action@v3
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: "Docker auth"
run: |-
gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: us-central1-docker.pkg.dev/ctrlplane-prod/apps/docs
tags: |
type=sha,format=short,prefix=
- name: Build
uses: docker/build-push-action@v6
if: github.ref != 'refs/heads/main'
with:
push: false
file: apps/docs/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
with:
push: true
file: apps/docs/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
deploy:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: "google-github-actions/auth@v2"
id: auth
with:
token_format: access_token
project_id: ctrlplane-prod
service_account: "[email protected]"
workload_identity_provider: "projects/591038869087/locations/global/workloadIdentityPools/github/providers/github"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: us-central1-docker.pkg.dev/ctrlplane-prod/apps/docs
tags: |
type=sha,format=short,prefix=
- id: "deploy"
uses: "google-github-actions/deploy-cloudrun@v2"
with:
service: "docs"
image: ${{ steps.meta.outputs.tags }}