-
Notifications
You must be signed in to change notification settings - Fork 12
129 lines (129 loc) · 4.67 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
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
npx commitlint --last --verbose
npm run build
npm test
semantic-release:
runs-on: ubuntu-latest
needs: [test]
outputs:
new_version: ${{ steps.semantic.outputs.new_release_version }}
release: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '14'
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
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/semantic-release-sentry-releases@2.11.0
@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'
registry-release:
needs: semantic-release
if: ${{ needs.semantic-release.outputs.release == 'yes' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/wfcd/warframe-status:latest
ghcr.io/wfcd/warframe-status:${{ needs.semantic-release.outputs.new_version }}