forked from Aaron/Kino-Website
added a build pipeline
This commit is contained in:
52
.gitea/workflows/build.yaml
Normal file
52
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
name: Gitea CI-CD Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# --- STAGE 1: TEST ---
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run Linter
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
# --- STAGE 2: BUILD & PUBLISH (Only on Main) ---
|
||||||
|
build-and-deploy:
|
||||||
|
needs: test
|
||||||
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Example: Building a Docker Image and pushing to Gitea's internal registry
|
||||||
|
- name: Login to Gitea Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.starfour.de
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: gitea.starfour.de/${{ github.repository }}:latest
|
||||||
Reference in New Issue
Block a user