This repository has been archived by the owner on Mar 18, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (103 loc) · 3.63 KB
/
publish.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
name: Publish
run-name: 🔖 Publish ${{ github.ref_name }}
on:
release:
types: ["published"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Changelog
id: changelog
uses: Bullrich/generate-release-changelog@master
env:
REPO: ${{ github.repository }}
- name: Update release
uses: tubone24/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changelog }}
prerelease: false
- name: Set release version
run: |
echo 'version = "${{ github.ref_name }}"'
sed -i -e 's/version = "0.0.0"/version = "${{ github.ref_name }}"/g' Cargo.toml
sed -i -e 's/version = "0.0.0"/version = "${{ github.ref_name }}"/g' Cargo.lock
- name: Rustup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install Cross
run: |
wget --quiet https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz
tar -xvzf cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz
- name: Build for Raspberry Pi 4 (64-bit)
run: ./cross build --target aarch64-unknown-linux-gnu --release
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: blitz-dashboard
SENTRY_PROJECT: yastatist
with:
version: ${{ github.ref_name }}
- name: Upload blitz-dashboard.armv7-unknown-linux-gnueabihf
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: target/aarch64-unknown-linux-gnu/release/blitz-dashboard
asset_name: blitz-dashboard.aarch64-unknown-linux-gnu
asset_content_type: application/octet-stream
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download release asset
uses: dsaltares/fetch-gh-release-asset@master
with:
version: tags/${{ github.ref_name }}
file: blitz-dashboard.aarch64-unknown-linux-gnu
target: blitz-dashboard.aarch64-unknown-linux-gnu
- name: Set up Tailscale
uses: tailscale/github-action@v1
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
version: "1.24.2"
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: unnecessary
config: |
Host yastatist
User pi
StrictHostKeyChecking no
- name: Rsync
run: |
chmod +x blitz-dashboard.aarch64-unknown-linux-gnu
rsync -avz blitz-dashboard.aarch64-unknown-linux-gnu yastatist:/home/pi/bin/blitz-dashboard
- name: Restart Web
run: |
ssh yastatist "sudo systemctl restart web
systemctl status --lines=0 web"
- name: Restart Crawler (RU)
if: ${{ true }}
run: |
ssh yastatist "sudo systemctl restart crawler-ru
systemctl status --lines=0 crawler-ru"
- name: Restart Crawler (EU)
if: ${{ true }}
run: |
ssh yastatist "sudo systemctl restart crawler-eu
systemctl status --lines=0 crawler-eu"