-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (74 loc) · 2.37 KB
/
deploy.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
name: Build and deploy
on:
workflow_dispatch:
jobs:
build:
name: Build for Raspberry PI
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Prepare toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.77.2-x86_64-unknown-linux-gnu
target: aarch64-unknown-linux-gnu
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target aarch64-unknown-linux-gnu
- uses: actions/upload-artifact@v4
with:
name: eitn30-artifact
path: |
target/aarch64-unknown-linux-gnu/release/eitn30-internet-inside
deploy/Makefile
overwrite: true
deploy:
name: ${{ matrix.name }}
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
org: [ts_ip_base, ts_ip_mobile] #Array of org mnemonics to use below
include:
# includes a new variable for each org (this is effectively a switch statement)
- org: ts_ip_base
ts_ip_secret: TS_IP_BASE
name: Deploy on base station
- org: ts_ip_mobile
ts_ip_secret: TS_IP_MOBILE
name: Deploy on mobile unit
steps:
- uses: actions/download-artifact@v4
with:
name: eitn30-artifact
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: List files
run: ls -l
- name: Move files to dist folder
run: |
mkdir dist
mv deploy/Makefile dist/Makefile
mv target/aarch64-unknown-linux-gnu/release/eitn30-internet-inside dist/eitn30-internet-inside
- name: ${{ matrix.name }}
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: '-z -i'
SOURCE: dist/*
REMOTE_HOST: ${{ secrets[matrix.ts_ip_secret] }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
SCRIPT_AFTER: |
sudo systemctl restart longge.service > /dev/null 2>&1