* chore: bump spring version to 4.0.5 * feat: add docker build to CI workflow * feat: add staging deploy - wip * fix: change triggers to include PR changes * feat: add server ci and deploy to stg * chore: add app build candidate * remove from branch, get from main * fix: build app candidate * fix: build app candidate * fix: fe changes in the app * fix: app ci workflow dispatch * chore: improve PR ci and cd * feat: make deployments always happen for PRs * feat: improve workflow names
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: Frontend Main
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'client/**/*.html'
|
|
- 'client/**/*.png'
|
|
- 'client/**/*.json'
|
|
- 'client/**/*.txt'
|
|
- 'client/**/*.ts'
|
|
- 'client/**/*.tsx'
|
|
- 'client/**/*.js'
|
|
- 'client/Dockerfile'
|
|
- 'client/Caddyfile'
|
|
- '.github/workflows/main-client.yml'
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build & Push
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate version tag
|
|
id: version
|
|
run: |
|
|
DATE=$(date +'%Y.%m.%d')
|
|
TAG="app-v${DATE}.${{ github.run_number }}"
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
echo "Generated tag: ${TAG}"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}/app
|
|
tags: |
|
|
type=raw,value=${{ steps.version.outputs.tag }}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./client
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
build-args: |
|
|
VITE_BUILD=v${{ steps.version.outputs.tag }}
|
|
|
|
- name: Create and push Git tag
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git tag -a ${{ steps.version.outputs.tag }} -m "Release ${{ steps.version.outputs.tag }}"
|
|
git push origin ${{ steps.version.outputs.tag }}
|
|
|