ci/cd: gitea deploy
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test-backend:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: golang:1.25-alpine3.21
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Test backend
|
||||
run: |
|
||||
cd kotosoft-id-backend
|
||||
go mod tidy
|
||||
go test ./...
|
||||
|
||||
lint-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Lint frontend
|
||||
run: |
|
||||
cd kotosoft-id-frontend
|
||||
npm install
|
||||
npm run lint
|
||||
|
||||
build-backend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and push backend
|
||||
run: |
|
||||
docker build \
|
||||
-t 172.17.0.1:5000/kotosoft_id_backend:latest \
|
||||
-f kotosoft-id-backend/Dockerfile \
|
||||
kotosoft-id-backend
|
||||
|
||||
docker push 172.17.0.1:5000/kotosoft_id_backend:latest
|
||||
|
||||
build-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and push frontend
|
||||
run: |
|
||||
docker build \
|
||||
-t 172.17.0.1:5000/kotosoft_id_frontend:latest \
|
||||
-f kotosoft-id-frontend/Dockerfile \
|
||||
kotosoft-id-frontend
|
||||
|
||||
docker push 172.17.0.1:5000/kotosoft_id_frontend:latest
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
FRONTEND_URL: ${{ secrets.FRONTEND_URL }}
|
||||
BACKEND_URL: ${{ secrets.BACKEND_URL }}
|
||||
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
|
||||
REDIS_URL: ${{ secrets.REDIS_URL }}
|
||||
JWT_SECRET: ${{ secrets.JWT_SECRET }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||
CLIENT_NAME: ${{ secrets.CLIENT_NAME }}
|
||||
CLIENT_REDIRECT_URIS: ${{ secrets.CLIENT_REDIRECT_URIS }}
|
||||
DOMAIN: ${{ secrets.DOMAIN }}
|
||||
API_DOMAIN: ${{ secrets.API_DOMAIN }}
|
||||
LETSENCRYPT_EMAIL: ${{ secrets.LETSENCRYPT_EMAIL }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
mkdir -p /opt/app
|
||||
cp docker-compose.yml /opt/app/docker-compose.yml
|
||||
cd /opt/app
|
||||
|
||||
docker compose -p kotosoft pull
|
||||
docker compose -p kotosoft up -d --remove-orphans
|
||||
Reference in New Issue
Block a user