-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (82 loc) · 2.09 KB
/
server.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
name: Server
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build server
defaults:
run:
working-directory: ./server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Check CLI tools
run: |
for tool in dotnet; do
if ! command -v $tool &> /dev/null; then
echo "${tool} is not installed"
exit 1
fi
${tool} --version
done
- name: Restore dependencies
run: |
dotnet restore
- name: Build
run: |
dotnet build --no-restore
- name: Test
env:
AUTH0_CLIENT_ID: ${{ vars.AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
MONGODB_DATABASE: ${{ vars.MONGODB_DATABASE }}
run: |
dotnet test --no-build --verbosity normal
- name: Upload deployment spec
uses: actions/upload-artifact@v4
with:
name: do
path: .do
deploy:
name: Deploy server
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DOCTL_TOKEN }}
- name: Update DigitalOcean app spec
if: ${{ github.ref == 'refs/heads/main' }}
run: |
doctl apps update ${{ secrets.DO_APP_ID }} \
--spec ${{ github.workspace }}/do/app.yaml
success:
name: Success
runs-on: ubuntu-latest
needs:
- build
- deploy
steps:
- name: Send status to Discord
uses: nebularg/actions-discord-webhook@v1
if: always()
with:
webhook_url: ${{ secrets.DISCORD_CI_WEBHOOK }}
status: ${{ job.status }}