This commit is contained in:
+10
-15
@@ -7,18 +7,18 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-deploy:
|
||||||
runs-on: linux
|
runs-on: linux:docker,dind
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v4
|
run: |
|
||||||
with:
|
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
|
||||||
node-version: '24'
|
apt-get install -y nodejs
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -26,24 +26,19 @@ jobs:
|
|||||||
- name: Build project
|
- name: Build project
|
||||||
run: npm run build
|
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
|
- name: Login to Gitea Container Registry
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login http://192.168.1.39:3000 -u "${{ secrets.GITEA_USERNAME }}" --password-stdin
|
echo "${{ secrets.GITEA_TOKEN }}" | docker login http://192.168.1.39:3000 -u "${{ secrets.GITEA_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push Docker image
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
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 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:latest
|
||||||
docker push 192.168.1.39:3000/username/pc-builder:${{ github.sha }}
|
docker push 192.168.1.39:3000/username/pc-builder:${{ github.sha }}
|
||||||
|
|
||||||
- name: Trigger deploy
|
- name: Trigger deploy
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
run: |
|
||||||
curl -X POST http://192.168.1.39:9000/deploy || echo "Deploy webhook not reachable"
|
curl -X POST http://192.168.1.39:9000/deploy || echo "Deploy webhook not reachable"
|
||||||
|
|||||||
Reference in New Issue
Block a user