Creating deploy.yml for CI/CD.
Some checks failed
Deploy Greenlight API / deploy (push) Has been cancelled
Some checks failed
Deploy Greenlight API / deploy (push) Has been cancelled
This commit is contained in:
41
.gitea/workflows/deploy.yml
Normal file
41
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Deploy Greenlight API
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23" # adapte selon ta version
|
||||
|
||||
- name: Build API
|
||||
run: |
|
||||
go mod tidy
|
||||
go build -o ./bin/greenlight-api ./cmd/api
|
||||
|
||||
- name: Deploy to server
|
||||
run: |
|
||||
# Dossier de déploiement
|
||||
DEPLOY_PATH=/var/www/greenlight-api
|
||||
|
||||
# Crée le dossier s'il n'existe pas
|
||||
sudo mkdir -p $DEPLOY_PATH
|
||||
|
||||
# Copie le binaire et éventuellement les assets
|
||||
sudo cp ./bin/greenlight-api $DEPLOY_PATH/greenlight
|
||||
|
||||
# Donne les bons droits
|
||||
sudo chown -R www-data:www-data $DEPLOY_PATH
|
||||
sudo chmod +x $DEPLOY_PATH/greenlight
|
||||
|
||||
# Redémarre le service systemd
|
||||
sudo systemctl restart greenlight-api.service
|
||||
Reference in New Issue
Block a user