-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 2.03 KB
/
wkflw.dev.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
name: Deploy to Raspberry Pi
on:
push:
branches:
- nightly
jobs:
deploy:
runs-on: ubuntu-latest
environment: dev
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
RASPBERRY_PI_IP: ${{ secrets.RPI_IP_DEV }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
RASPBERRY_PI_UNAME: ${{ secrets.RASPBERRY_PI_UNAME }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up SSH on actions container
uses: appleboy/[email protected]
with:
host: ${{ secrets.RPI_IP_DEV }}
username: ${{ secrets.RASPBERRY_PI_UNAME }}
password: "10645641993"
script: whoami
# run: |
# mkdir -p ~/.ssh
# echo $SSH_PRIVATE_KEY > ~/.ssh/id_rsa
# cat ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# ssh-keyscan -H $RASPBERRY_PI_IP >> ~/.ssh/known_hosts
# # ssh-keyscan -H ${RASPBERRY_PI_IP}
# uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# - name: Get current branch name
# id: get_branch
# run: |
# echo "Branch ref: $GITHUB_REF"
# BRANCH_NAME=${GITHUB_REF#refs/heads/}
# echo "Branch name: $BRANCH_NAME"
# echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
# - name: Clone telegnotify repository to Raspberry pi and compile it
# run: |
# ssh ${RASPBERRY_PI_UNAME}@${RASPBERRY_PI_IP} "
# mkdir -p "/home/${RASPBERRY_PI_UNAME}/source/github.com/eensymachines.in/telegnotify"
# cd "/home/${RASPBERRY_PI_UNAME}/source/github.com/eensymachines.in/telegnotify"
# if [ -z $(ls -A "/home/${RASPBERRY_PI_UNAME}/source/github.com/eensymachines.in/telegnotify") ]; then\
# git clone ${REPO_URL}\
# else\
# git pull origin ${{ env.BRANCH_NAME }}
# git checkout ${{ env.BRANCH_NAME }}
# go build . -o /usr/local/bin/telegnotify
# "