mirror of
https://github.com/hazemKrimi/touch-programming.git
synced 2026-05-01 18:20:26 +00:00
Setup auto deploy with GitHub Actions
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
name: Deployment to VPS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Build client
|
||||
run:
|
||||
cd client
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23.x'
|
||||
|
||||
- name: Build server
|
||||
run:
|
||||
cd server
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o executable
|
||||
|
||||
- name: Prepare to deploy
|
||||
run:
|
||||
mkdir touch-programming.hazemkrimi.tech
|
||||
mkdir touch-programming.hazemkrimi.tech/public
|
||||
mkdir touch-programming.hazemkrimi.tech/api
|
||||
cp -r client/build touch-programming.hazemkrimi.tech/public
|
||||
cp server/executable touch-programming.hazemkrimi.tech/api
|
||||
|
||||
- name: Deploy to VPS
|
||||
uses: appleboy/scp-action@v0.1.4
|
||||
with:
|
||||
host: hazemkrimi.tech
|
||||
username: deploy
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
source: "touch-programming.hazemkrimi.tech"
|
||||
target: "/var/www"
|
||||
Reference in New Issue
Block a user