ded07c23b6
Deploy / build-and-push (push) Has been cancelled
Deploy / deploy-staging (push) Has been cancelled
Deploy / deploy-production (push) Has been cancelled
Test and Build / backend-test (push) Has been cancelled
Test and Build / frontend-test (push) Has been cancelled
Test and Build / docker-build (push) Has been cancelled
Test and Build / test-summary (push) Has been cancelled
- Fix TypeScript type mismatch in CreateBucketDialog component - Make form fields optional to match yup schema validation - Add comprehensive Gitea Actions workflows for testing and deployment - Set up parallel testing for backend and frontend - Configure Docker build verification in CI pipeline - Add deployment workflow with staging and production environments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
147 lines
4.8 KiB
YAML
147 lines
4.8 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags: [ 'v*' ]
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
description: 'Deployment environment'
|
|
required: true
|
|
default: 'staging'
|
|
type: choice
|
|
options:
|
|
- staging
|
|
- production
|
|
|
|
env:
|
|
REGISTRY: gitea.nothaft.cloud
|
|
IMAGE_NAME: ${{ gitea.repository }}
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
outputs:
|
|
backend-image: ${{ steps.meta-backend.outputs.tags }}
|
|
frontend-image: ${{ steps.meta-frontend.outputs.tags }}
|
|
version: ${{ steps.meta-backend.outputs.version }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# Backend Image
|
|
- name: Extract backend metadata
|
|
id: meta-backend
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backend
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha,prefix={{branch}}-
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push backend image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./backend
|
|
file: ./docker/Dockerfile.backend
|
|
push: true
|
|
tags: ${{ steps.meta-backend.outputs.tags }}
|
|
labels: ${{ steps.meta-backend.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
build-args: |
|
|
BUILD_DATE=${{ fromJSON(steps.meta-backend.outputs.json).labels['org.opencontainers.image.created'] }}
|
|
VERSION=${{ fromJSON(steps.meta-backend.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
|
|
# Frontend Image
|
|
- name: Extract frontend metadata
|
|
id: meta-frontend
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha,prefix={{branch}}-
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push frontend image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./frontend
|
|
file: ./docker/Dockerfile.frontend
|
|
push: true
|
|
tags: ${{ steps.meta-frontend.outputs.tags }}
|
|
labels: ${{ steps.meta-frontend.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
build-args: |
|
|
BUILD_DATE=${{ fromJSON(steps.meta-frontend.outputs.json).labels['org.opencontainers.image.created'] }}
|
|
VERSION=${{ fromJSON(steps.meta-frontend.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
|
|
deploy-staging:
|
|
runs-on: ubuntu-latest
|
|
needs: build-and-push
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event.inputs.environment == 'staging'
|
|
environment: staging
|
|
|
|
steps:
|
|
- name: Deploy to Staging
|
|
run: |
|
|
echo "Deploying to staging environment"
|
|
echo "Backend image: ${{ needs.build-and-push.outputs.backend-image }}"
|
|
echo "Frontend image: ${{ needs.build-and-push.outputs.frontend-image }}"
|
|
|
|
# Add your deployment commands here
|
|
# For example, using SSH to update docker-compose on staging server:
|
|
# ssh ${{ secrets.STAGING_HOST }} "cd /opt/minio-webui && docker compose pull && docker compose up -d"
|
|
|
|
deploy-production:
|
|
runs-on: ubuntu-latest
|
|
needs: build-and-push
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.environment == 'production'
|
|
environment: production
|
|
|
|
steps:
|
|
- name: Deploy to Production
|
|
run: |
|
|
echo "Deploying to production environment"
|
|
echo "Backend image: ${{ needs.build-and-push.outputs.backend-image }}"
|
|
echo "Frontend image: ${{ needs.build-and-push.outputs.frontend-image }}"
|
|
echo "Version: ${{ needs.build-and-push.outputs.version }}"
|
|
|
|
# Add your production deployment commands here
|
|
# For example:
|
|
# ssh ${{ secrets.PROD_HOST }} "cd /opt/minio-webui && ./scripts/deploy.sh update"
|
|
|
|
- name: Create Release Notes
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
generate_release_notes: true
|
|
draft: false
|
|
prerelease: false |