You've already forked reloading-manager
Modified the push command in the CI workflow to correctly target the release branch for deployment. This ensures that changes are pushed to the appropriate branch, enhancing the deployment process.
142 lines
5.0 KiB
YAML
142 lines
5.0 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
name: 🏗️ ✨ Build Workflow
|
|
|
|
jobs:
|
|
BuildFrontend:
|
|
name: 🖼️ 🔨 Build Frontend
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 📖 🔍 Checkout Repository Code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: 🔑 🔐 Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: 🔑 🛠️ Login to Siteworx Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.SITEWORX_USERNAME }}
|
|
password: ${{ secrets.SITEWORX_PASSWORD }}
|
|
registry: scr.siteworxpro.com
|
|
|
|
- name: 🏗️ 🔧 Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: 🐳 🔨 Build Frontend Container
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
build-args: |
|
|
VITE_API=https://reloading-manager.internal.siteworxpro.com/api
|
|
context: ./frontend
|
|
file: ./frontend/Dockerfile
|
|
tags: scr.siteworxpro.com/reloading-manager/frontend:${{ gitea.ref_name }}
|
|
push: true
|
|
|
|
- name: 📦 ✨ Build Latest Frontend Container
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
build-args: |
|
|
VITE_API=https://reloading-manager.internal.siteworxpro.com/api
|
|
context: ./frontend
|
|
file: ./frontend/Dockerfile
|
|
tags: scr.siteworxpro.com/reloading-manager/frontend:latest
|
|
push: true
|
|
|
|
BuildBackend:
|
|
name: 🖥️ 🔨 Build Backend
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 📖🔍 Checkout Repository Code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: 🔑 🔐 Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: 🔑 🛠️ Login to Siteworx Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.SITEWORX_USERNAME }}
|
|
password: ${{ secrets.SITEWORX_PASSWORD }}
|
|
registry: scr.siteworxpro.com
|
|
|
|
- name: 🏗️ 🔧 Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: 🐳 🔨 Build Backend Container
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./backend
|
|
file: ./backend/Dockerfile
|
|
tags: scr.siteworxpro.com/reloading-manager/backend:${{ gitea.ref_name }}
|
|
push: true
|
|
|
|
- name: 📦 ✨ Build Latest Backend Container
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./backend
|
|
file: ./backend/Dockerfile
|
|
tags: scr.siteworxpro.com/reloading-manager/backend:latest
|
|
push: true
|
|
|
|
Deploy:
|
|
name: 🚀 ✨ Deploy Application
|
|
runs-on: ubuntu-latest
|
|
needs: [BuildFrontend, BuildBackend]
|
|
steps:
|
|
- name: 📖 🔍 Checkout Repository Code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: 📝 🔧 Update Deployment Manifest
|
|
run: |
|
|
echo "## Do not edit this file directly. It is auto-generated by the script." > argocd/deployment/deployment.yml
|
|
sed "s|__TAG__|${{ gitea.ref_name }}|g" argocd/template/deployment.yml >> argocd/deployment/deployment.yml
|
|
|
|
- name: 📤 📦 Recommit Build Artifacts
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: alpine/git
|
|
options: --volumes-from ${{ env.JOB_CONTAINER_NAME }} -w ${{ gitea.workspace }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
chmod 700 ~/.ssh
|
|
ssh-keyscan -H gitea.siteworxpro.com >> ~/.ssh/known_hosts
|
|
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
eval "$(ssh-agent -s)"
|
|
ssh-add ~/.ssh/id_rsa
|
|
git config --global user.email "gitea@siteworxpro.com"
|
|
git config --global user.name "Gitea-Runner via Gitea Actions"
|
|
git config --global push.autoSetupRemote true
|
|
git remote rm origin && git remote add origin "git@gitea.siteworxpro.com:siteworxpro/reloading-manager.git"
|
|
git add -f "argocd/deployment/*" || true
|
|
git checkout -b release/${{ gitea.ref_name }}-deploy || git checkout release/${{ gitea.ref_name }}-deploy
|
|
git commit -m "Build Auto Commit" || echo "No changes to commit"
|
|
git push origin release/${{ gitea.ref_name }} -o ci.skip || echo "No changes to push"
|
|
|
|
- name: 🚀 ✨ Create Pull Request
|
|
uses: peter-evans/create-pull-request@v7
|
|
env:
|
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
|
with:
|
|
base: master
|
|
add-paths: argocd/deployment/deployment.yml
|
|
title: "🚀 ✨ Release ${GITHUB_REF_NAME} - Deploy"
|
|
branch: release/${{ gitea.ref_name }}-deploy
|
|
committer: "Gitea Action 🤖 <gitia@siteworxpro.com>"
|
|
body: "📝 🔄 Update deployment manifest with new image tags for release ${{ gitea.ref_name }}" |