-
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (60 loc) · 1.85 KB
/
main.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
name: Deploy
on:
push:
tags:
- 'v*'
workflow_dispatch: {}
jobs:
deploy:
runs-on: ubuntu-20.04
services:
mongo:
image: mongo:4.2.9-bionic
env:
MONGO_INITDB_DATABASE: osrsloadouts
ports:
- 27017:27017
options: -v ${{ github.workspace }}/scripts/migrations:/docker-entrypoint-initdb.d
redis:
image: redis:5.0.9-alpine
ports:
- 6379:6379
steps:
- name: Fix mounted volume owner
run: |
sudo chown -R $USER:root ${{ github.workspace }}
- uses: actions/checkout@v2
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Sops Binary Installer
uses: mdgreenwald/mozilla-sops-action@v1
with:
version: 'v3.5.0'
- name: Set up Go 1.14
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Migrate DB
env:
SECRET_FILE: secrets/dev.env
run: |
sops exec-env ${SECRET_FILE} 'mongo ${OSRSLOADOUTS_MONGO_ADDR} --eval "db.db_migrations.insertOne({db_version: 0})"'
make migration
- name: Test
run: |
make deps
make test
- name: Deploy
env:
OSRSLOADOUTS_MONGO_ADDR: ${{secrets.OSRSLOADOUTS_MONGO_ADDR}}
OSRSLOADOUTS_REDIS_ADDR: ${{secrets.OSRSLOADOUTS_REDIS_ADDR}}
OSRSLOADOUTS_REDIS_PASS: ${{secrets.OSRSLOADOUTS_REDIS_PASS}}
run: |
sops -d secrets/service-account.json > /tmp/account.json
gcloud auth activate-service-account --key-file=/tmp/account.json
gcloud config set project "${{ secrets.PROJECT_ID }}"
gcloud auth configure-docker
make release-all