-
Notifications
You must be signed in to change notification settings - Fork 12
97 lines (97 loc) · 3.56 KB
/
release.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: Verify
env:
CI: true
TWITTER_KEY: ${{ secrets.TWITTER_KEY }}
TWITTER_SECRET: ${{ secrets.TWITTER_SECRET }}
TWITTER_TIMEOUT: ${{ secrets.TWITTER_TIMEOUT }}
TWITTER_BEARER_TOKEN:
${{ secrets.TWITTER_BEARER_TOKEN }}
run: |
npm ci
npm i warframe-items@latest warframe-worldstate-parser@latest warframe-worldstate-data@latest @wfcd/arsenal-parser@latest
npm run lint
npm run build
npm test
semantic-release:
runs-on: ubuntu-latest
needs: [ test ]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: '14'
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
with:
semantic_version: 17
extra_plugins: |
@eclass/[email protected]
@semantic-release/git
@semantic-release/exec
- name: Read .release file
id: release
run: echo "release=$(cat .release)" >> $GITHUB_OUTPUT
- name: Create Sentry release
if: ${{ steps.release.outputs.release == 'yes' }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
# Built from https://blog.benoitblanchon.fr/github-action-run-ssh-commands/
- name: Deploy - Configure
if: ${{ steps.release.outputs.release == 'yes' }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/prod.key
chmod 600 ~/.ssh/prod.key
cat >>~/.ssh/config <<END
Host prod
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/prod.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.PROD_SSH_USER }}
SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
SSH_HOST: ${{ secrets.PROD_SSH_HOST }}
- name: Deploy - Stop Process
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh prod 'source ~/.zshrc && pm2 kill'
- name: Deploy - Update server
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && git checkout -- . && git fetch --all && git reset --hard origin/main'
- name: Deploy - Update dependencies
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && rm -rf node_modules && nvm install && nvm use && npm ci && npm run build && npm i -g pm2@latest'
- name: Deploy - Start Process
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && pm2 start warframe-status.json'