50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Build & Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: linux
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build project
|
|
run: npm run build
|
|
|
|
docker:
|
|
needs: build
|
|
runs-on: linux:docker,dind
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Container Registry
|
|
run: |
|
|
echo "${{ secrets.GITEA_TOKEN }}" | docker login http://192.168.1.39:3000 -u "${{ secrets.GITEA_USERNAME }}" --password-stdin
|
|
|
|
- name: Build and push
|
|
run: |
|
|
docker build -t 192.168.1.39:3000/username/pc-builder:latest -t 192.168.1.39:3000/username/pc-builder:${{ github.sha }} .
|
|
docker push 192.168.1.39:3000/username/pc-builder:latest
|
|
docker push 192.168.1.39:3000/username/pc-builder:${{ github.sha }}
|
|
|
|
- name: Trigger deploy
|
|
run: |
|
|
curl -X POST http://192.168.1.39:9000/deploy || echo "Deploy webhook not reachable"
|