-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (74 loc) · 2.36 KB
/
build.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
name: Build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- run: cargo build --verbose --release
- run: cargo test --verbose --release
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
target/release/bot
target/release/notify
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Create changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-push: "false"
skip-version-file: "true"
output-file: "false"
skip-commit: "true"
skip-on-empty: "true"
skip-tag: "true"
- uses: actions/download-artifact@v3
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
name: artifacts
path: artifacts
- name: Create Release
run: gh release create "$TAG_NAME" --notes "$BODY" artifacts/bot artifacts/notify
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ steps.changelog.outputs.tag }}
BODY: ${{ steps.changelog.outputs.clean_changelog }}
- name: rsync bot
uses: burnett01/[email protected]
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
switches: -avzrP
path: artifacts/
remote_path: /apps/ah_bonus_bot/
remote_host: ${{ secrets.SSH_HOST }}
remote_port: ${{ secrets.SSH_PORT }}
remote_user: ${{ secrets.SSH_USER }}
remote_key: ${{ secrets.SSH_KEY }}
- name: Restart service
uses: appleboy/ssh-action@master
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
chmod +x /apps/ah_bonus_bot/bot /apps/ah_bonus_bot/notify
sudo systemctl restart ah_bonus_bot.service