Merge branch 'main' of https://github.com/Gsvd/gsvd.dev #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.23 | |
- 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: Compiling | |
run: GOOS=linux GOARCH=amd64 go build -o ./cmd/gsvd.dev/tmp/main ./cmd/gsvd.dev | |
- name: Deploying | |
run: | | |
ssh [email protected] 'sudo systemctl stop gsvd.dev.service' | |
scp ./cmd/gsvd.dev/tmp/main [email protected]:/home/deployer/gsvd.dev | |
ssh [email protected] 'sudo systemctl start gsvd.dev.service' |