Public Access
Changed wokflow
This commit is contained in:
1 parent
597890495e
commit
a3c90d4628
2 files changed
+72
-28
No files matched your search
@@ -1,28 +0,0 @@
|
|||||||
name: Build and Publish Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Log in to Codeberg Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: codeberg.org
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
# Requires a generated Application Token from your Codeberg settings saved as a repository secret
|
|
||||||
password: ${{ secrets.CODEBERG_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: codeberg.org/${{ github.repository }}:latest
|
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
name: Build, Test & Push Frontend
|
||||||
|
|
||||||
|
# Trigger the workflow
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# JOB 1: Code integrity and quality gates (CI)
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
quality-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
# Run ESLint if configured in package.json
|
||||||
|
- name: Lint & Type Check
|
||||||
|
run: npm run lint --if-present
|
||||||
|
|
||||||
|
# Build the Vite React application
|
||||||
|
- name: Build Production
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# JOB 2: Docker Build & Push (CD)
|
||||||
|
# Runs only if 'quality-check' is successful and we are on branch main
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
docker:
|
||||||
|
needs: quality-check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare tag
|
||||||
|
id: prep
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Sanitize branch name for valid Docker tags
|
||||||
|
BRANCH="${GITHUB_REF_NAME}"
|
||||||
|
BRANCH="${BRANCH//\//-}"
|
||||||
|
BRANCH="$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "sha=${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build & Push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/tobeplayed-frontend:${{ steps.prep.outputs.branch }}
|
||||||
|
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/tobeplayed-frontend:${{ steps.prep.outputs.branch }}-${{ steps.prep.outputs.sha }}
|
||||||
|
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/tobeplayed-frontend:latest
|
||||||
Reference in new issue
Block a user