-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (88 loc) · 2.56 KB
/
cicd.yml
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
name: CICD
on:
push:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
- run: go mod download
- run: go install github.com/a-h/templ/cmd/templ@latest
- run: templ generate -path ./components
- name: Test
run: go test -race ./...
tag:
name: Tag
permissions:
contents: write
runs-on: ubuntu-latest
needs:
- lint
- test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Version
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
- name: Create Tag
uses: negz/create-tag@v1
with:
version: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
needs:
- tag
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
- name: Get Version
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
- run: go mod download
- run: go install github.com/a-h/templ/cmd/templ@latest
- name: Generate Templ Files
run: templ generate -path ./components
- name: Install Tailwindcss CLI
run: |
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64
chmod +x tailwindcss-linux-x64
mv tailwindcss-linux-x64 tailwindcss
- name: Generate CSS
run: tailwindcss -i ./styles/input.css -o ./assets/css/output@${{ env.VERSION }}.css --minify
- name: Replace token secret
run: sed -i 's/\${secrets.DB_TOKEN}/'"$DB_TOKEN"'/' app.yaml
env:
DB_TOKEN: ${{ secrets.DB_TOKEN }}
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: 'projects/811165903449/locations/global/workloadIdentityPools/gh-pool/providers/gh-provider'
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
- id: 'deploy'
uses: 'google-github-actions/deploy-appengine@v1'
with:
version: ${{ env.VERSION }}