-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (52 loc) · 1.33 KB
/
branch.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
name: ci-cd
on:
push:
branches:
- main
permissions:
contents: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: Install dependencies
run: go get .
- name: Build
run: go build -race -v ./...
- name: Test
run: go test -race -v ./...
deploy:
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- uses: actions/checkout@v3
- name: Setup GCP Auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA }}
- name: SSH into instance and run deploy command
uses: google-github-actions/ssh-compute@v1
with:
instance_name: fluentify-server
zone: us-west4-b
user: ${{ secrets.GCP_SSH_USER }}
ssh_private_key: ${{ secrets.GCP_SSH_PRIVATE_KEY }}
command: cd ~/fluentify-server && pwd && sh ./bin/deploy.sh