-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.3 KB
/
deploy.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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build_bot:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
cd bot
npm install
- run: npm run prod:build
- name: bot/dist
uses: actions/upload-artifact@v2
with:
name: bot
path: bot/dist
build:
needs:
- build_bot
runs-on: self-hosted
strategy:
matrix:
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Create env file
run: |
cd bot
touch .env
echo DISCORD_BOT_TOKEN=${{ secrets.DISCORD_BOT_TOKEN }} >> .env
echo DISCORD_CHANNEL_WEBHOOK=${{ secrets.DISCORD_CHANNEL_WEBHOOK }} >> .env
echo MONGODB_PRODUCTION_URL=${{ secrets.MONGODB_PRODUCTION_URL }} >> .env
echo TWITCH_CLIENT_ID=${{ secrets.TWITCH_CLIENT_ID }} >> .env
echo TWITCH_CLIENT_SECRET=${{ secrets.TWITCH_CLIENT_SECRET }} >> .env
echo TWITCH_HUB_CALLBACK=${{ secrets.TWITCH_HUB_CALLBACK }} >> .env
echo TWITCH_OAUTH_TOKEN=${{ secrets.TWITCH_OAUTH_TOKEN }} >> .env
echo YOUTUBE_API_KEY=${{ secrets.YOUTUBE_API_KEY }} >> .env
cat .env
- run: npm run down
- run: docker image prune -a -f
- run: |
cd bot
mkdir dist
- name: Download dist from build_bot
uses: actions/download-artifact@v2
with:
name: bot
path: bot/dist
- run: npm run prod
- run: docker image prune -a -f