-
Notifications
You must be signed in to change notification settings - Fork 39
72 lines (72 loc) · 2.68 KB
/
release.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
name: Release
on:
workflow_dispatch:
push:
branches:
- master
jobs:
semantic-release:
runs-on: ubuntu-latest
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.5.4
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
@semantic-release/git
@semantic-release/changelog
@semantic-release/exec
- name: Read .release file
id: release
run: echo "::set-output name=release::$(cat .release)"
- 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: 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 bot
HostName $SSH_BOT_HOST
Port $SSH_BOT_PORT
User $SSH_USER
IdentityFile ~/.ssh/prod.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_BOT_HOST: ${{ secrets.SSH_BOT_HOST }}
SSH_BOT_PORT: ${{ secrets.SSH_BOT_PORT }}
DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH }}
- name: Stop Bot Process
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh bot 'source ~/.zshrc && cd ~/services/genesis-docker && { make -f docker.Makefile down_prod } || echo "Nothing to stop"'
- name: Update Containers
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh bot 'source ~/.zshrc && cd ~/services/genesis-docker && make -f docker.Makefile submod bot notifier'
- name: Restart Containers
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh bot 'source ~/.zshrc && cd ~/services/genesis-docker && make -f docker.Makefile up_prod'