Skip to content

Making repo public

Making repo public #34

Workflow file for this run

name: Deploy to Raspberry Pi
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Install dependencies and build CSS
run: |
npm ci
npm run build
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking=no" >> ~/.ssh/config
- name: Compile for Raspberry Pi
run: GOOS=linux GOARCH=arm GOARM=7 go build -o ./cmd/gsvd.dev/tmp/main ./cmd/gsvd.dev
- name: Deploy to Raspberry Pi
run: |
ssh deployer@${{ secrets.PI_HOSTNAME }} 'sudo systemctl stop gsvd.dev.service'
scp ./cmd/gsvd.dev/tmp/main deployer@${{ secrets.PI_HOSTNAME }}:/home/deployer/gsvd.dev
ssh deployer@${{ secrets.PI_HOSTNAME }} 'sudo systemctl start gsvd.dev.service'