migrate from drone to gitea actions
This commit is contained in:
+26
-13
@@ -1,3 +1,4 @@
|
|||||||
|
```yaml
|
||||||
name: Build and Deploy
|
name: Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -8,8 +9,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test-backend:
|
test-backend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: golang:1.25-alpine3.21
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -17,14 +16,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Test backend
|
- name: Test backend
|
||||||
run: |
|
run: |
|
||||||
cd kotosoft-id-backend
|
docker run --rm \
|
||||||
go mod tidy
|
-v "$PWD/kotosoft-id-backend:/app" \
|
||||||
go test ./...
|
-w /app \
|
||||||
|
golang:1.25-alpine3.21 \
|
||||||
|
sh -c 'go mod tidy && go test ./...'
|
||||||
|
|
||||||
lint-frontend:
|
lint-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: node:20-alpine
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -32,9 +31,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Lint frontend
|
- name: Lint frontend
|
||||||
run: |
|
run: |
|
||||||
cd kotosoft-id-frontend
|
docker run --rm \
|
||||||
npm install
|
-v "$PWD/kotosoft-id-frontend:/app" \
|
||||||
npm run lint
|
-w /app \
|
||||||
|
node:20-alpine \
|
||||||
|
sh -c 'npm install && npm run lint'
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -43,13 +44,15 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build and push backend
|
- name: Build backend
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
-t 172.17.0.1:5000/kotosoft_id_backend:latest \
|
-t 172.17.0.1:5000/kotosoft_id_backend:latest \
|
||||||
-f kotosoft-id-backend/Dockerfile \
|
-f kotosoft-id-backend/Dockerfile \
|
||||||
kotosoft-id-backend
|
kotosoft-id-backend
|
||||||
|
|
||||||
|
- name: Push backend
|
||||||
|
run: |
|
||||||
docker push 172.17.0.1:5000/kotosoft_id_backend:latest
|
docker push 172.17.0.1:5000/kotosoft_id_backend:latest
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
@@ -59,18 +62,26 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build and push frontend
|
- name: Build frontend
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
-t 172.17.0.1:5000/kotosoft_id_frontend:latest \
|
-t 172.17.0.1:5000/kotosoft_id_frontend:latest \
|
||||||
-f kotosoft-id-frontend/Dockerfile \
|
-f kotosoft-id-frontend/Dockerfile \
|
||||||
kotosoft-id-frontend
|
kotosoft-id-frontend
|
||||||
|
|
||||||
|
- name: Push frontend
|
||||||
|
run: |
|
||||||
docker push 172.17.0.1:5000/kotosoft_id_frontend:latest
|
docker push 172.17.0.1:5000/kotosoft_id_frontend:latest
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- test-backend
|
||||||
|
- lint-frontend
|
||||||
|
- build-backend
|
||||||
|
- build-frontend
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FRONTEND_URL: ${{ secrets.FRONTEND_URL }}
|
FRONTEND_URL: ${{ secrets.FRONTEND_URL }}
|
||||||
BACKEND_URL: ${{ secrets.BACKEND_URL }}
|
BACKEND_URL: ${{ secrets.BACKEND_URL }}
|
||||||
@@ -93,7 +104,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p /opt/app
|
mkdir -p /opt/app
|
||||||
cp docker-compose.yml /opt/app/docker-compose.yml
|
cp docker-compose.yml /opt/app/docker-compose.yml
|
||||||
|
|
||||||
cd /opt/app
|
cd /opt/app
|
||||||
|
|
||||||
docker compose -p kotosoft pull
|
docker compose -p kotosoft pull
|
||||||
docker compose -p kotosoft up -d --remove-orphans
|
docker compose -p kotosoft up -d --remove-orphans
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user