This commit is contained in:
Alexis Bruneteau 2025-10-22 00:44:02 +02:00
parent 770c41d5e0
commit 1ca02412a9
3 changed files with 15 additions and 13 deletions

View File

@ -6,8 +6,8 @@ This directory contains the Gitea Actions workflow for building and deploying th
### Triggers ### Triggers
- **Push** to `main` or `dashboard` branches - **Push** to any branch
- **Pull Request** to `main` or `dashboard` branches - **Pull Request** to any branch
### Jobs ### Jobs
@ -33,7 +33,7 @@ Runs on every push and pull request.
#### 2. Deploy Job #### 2. Deploy Job
Runs only on push to `main` or `dashboard` branches (not on PRs). Runs on push to any branch (not on PRs).
**Steps:** **Steps:**
1. Checkout code 1. Checkout code
@ -77,7 +77,7 @@ Configure these in Gitea repository settings:
- Pushes image to registry - Pushes image to registry
- **Does not deploy** to Kubernetes - **Does not deploy** to Kubernetes
### On Push to main/dashboard ### On Push to any branch
- Builds and tests the code - Builds and tests the code
- Pushes image to registry - Pushes image to registry
@ -192,10 +192,14 @@ git commit -m "docs: Update README [skip ci]"
### Change Deployment Conditions ### Change Deployment Conditions
Edit the `if` condition in deploy job: Edit the `if` condition in deploy job to deploy only on specific branches:
```yaml ```yaml
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dashboard' # Deploy on any push
if: github.event_name == 'push'
# Or deploy only on specific branches
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/production'
``` ```
### Add Slack/Email Notifications ### Add Slack/Email Notifications

View File

@ -3,12 +3,10 @@ name: Build and Deploy SQDC Dashboard
on: on:
push: push:
branches: branches:
- main - '**'
- dashboard
pull_request: pull_request:
branches: branches:
- main - '**'
- dashboard
jobs: jobs:
build: build:
@ -51,7 +49,7 @@ jobs:
name: Deploy to Kubernetes name: Deploy to Kubernetes
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dashboard' if: github.event_name == 'push'
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@ -202,8 +202,8 @@ In your Gitea repository, add the following secrets:
The workflow file is already created at `.gitea/workflows/build-deploy.yml` The workflow file is already created at `.gitea/workflows/build-deploy.yml`
**Workflow triggers:** **Workflow triggers:**
- Push to `main` or `dashboard` branch - Push to any branch
- Pull requests to `main` or `dashboard` branch - Pull requests to any branch
**Workflow steps:** **Workflow steps:**
1. Build - Runs tests, builds Docker image, and pushes to container registry 1. Build - Runs tests, builds Docker image, and pushes to container registry