-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (61 loc) · 1.91 KB
/
go.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
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io/terratensor
REGISTRY_HOST: ghcr.io
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: ${{ env.REGISTRY_HOST }}
username: audetv
password: ${{ github.token }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.1
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Inject branch slug
uses: rlespinasse/[email protected]
- name: Set image tag
run: echo "::set-env name=IMAGE_TAG::${{ env.GITHUB_REF_SLUG }}-${GITHUB_RUN_NUMBER}"
- name: Build
run: make docker-build
- name: Push build cache images
run: make push-build-cache
- name: Push
run: make push
if: ${{ github.ref == 'refs/heads/main' }}
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.PRODUCTION_KEY }}
known_hosts: ${{ secrets.PRODUCTION_HOST }}
if: ${{ github.ref == 'refs/heads/main' }}
- name: Deploy
run: make deploy
env:
BUILD_NUMBER: ${GITHUB_RUN_NUMBER}
HOST: ${{ secrets.PRODUCTION_HOST }}
PORT: ${{ secrets.PRODUCTION_PORT }}
APP_POSTGRES_HOST: ${{ secrets.APP_POSTGRES_HOST }}
APP_POSTGRES_DB: ${{ secrets.APP_POSTGRES_DB }}
APP_POSTGRES_USER: ${{ secrets.APP_POSTGRES_USER }}
APP_TG_BOT_TOKEN_FILE: ${{ secrets.APP_TG_BOT_TOKEN_FILE }}
APP_SENTRY_DSN_FILE: ${{ secrets.APP_SENTRY_DSN_FILE }}
APP_DB_PASSWORD_FILE: ${{ secrets.APP_DB_PASSWORD_FILE }}
if: ${{ github.ref == 'refs/heads/main' }}