You've already forked reloading-manager
151 lines
5.1 KiB
YAML
151 lines
5.1 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- '**'
|
|
|
|
name: 🏗️✨ Build Workflow
|
|
|
|
jobs:
|
|
BuildFrontend:
|
|
name: 🖼️🔨 Build Frontend
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: 🛡️🔒 Add Siteworx CA Certificates
|
|
run: |
|
|
apt update && apt install -yq ca-certificates curl
|
|
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
|
|
update-ca-certificates
|
|
|
|
- name: 📖🔍 Checkout Repository Code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: 🔑🔐 Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: 🔑🛠️ Login to Siteworx Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.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: 🛡️🔒 Add Siteworx CA Certificates
|
|
run: |
|
|
apt update && apt install -yq ca-certificates curl
|
|
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
|
|
update-ca-certificates
|
|
|
|
- name: 📖🔍 Checkout Repository Code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: 🔑🔐 Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: 🔑🛠️ Login to Siteworx Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.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: 🛡️🔒 Add Siteworx CA Certificates
|
|
run: |
|
|
apt update && apt install -yq ca-certificates curl
|
|
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
|
|
update-ca-certificates
|
|
|
|
- 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: 💾✅ Commit Updated Manifest
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
new_branch: release/${{ gitea.ref_name }}-deploy
|
|
add: argocd/deployment/deployment.yml
|
|
author_name: "GitHub Action 🤖"
|
|
author_email: gitia@siteworxpro.com
|
|
message: "📝🔄 Update deployment manifest with new image tags"
|
|
|
|
- name: 🚀✨ Create Pull Request
|
|
uses: peter-evans/create-pull-request@v7
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
author: "GitHub Action 🤖"
|
|
title: "🚀✨ Deploy Application Version ${{ gitea.ref_name }}"
|
|
branch: release/${{ gitea.ref_name }}-deploy
|
|
commit-message: "📝🔄 Update deployment manifest with new image tags"
|
|
body: |
|
|
This pull request updates the deployment manifest with the new image tags for version `${{ gitea.ref_name }}`.
|
|
Please review and merge to deploy the new version.
|
|
labels: deploy |