2026-03-30 22:14:27 +02:00
|
|
|
x-site_matrix: &site_matrix
|
2026-03-30 23:41:03 +02:00
|
|
|
- site: "harbor"
|
|
|
|
|
dest: /var/www/harbor
|
|
|
|
|
config_file: "harbor.json"
|
|
|
|
|
- site: "atlantis"
|
|
|
|
|
dest: /var/www/atlantis
|
|
|
|
|
config_file: "atlantis.json"
|
|
|
|
|
- site: "amiral"
|
|
|
|
|
dest: /var/www/amiral
|
|
|
|
|
config_file: "amiral.json"
|
2026-03-27 23:33:21 +01:00
|
|
|
|
2026-03-30 19:43:48 +02:00
|
|
|
name: Build and deploy all
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
|
|
|
|
- main
|
|
|
|
|
|
2026-03-15 18:38:59 +01:00
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
runs-on: docker
|
2026-03-27 23:33:21 +01:00
|
|
|
strategy:
|
2026-03-30 22:14:27 +02:00
|
|
|
matrix:
|
|
|
|
|
include: *site_matrix
|
2026-03-15 18:38:59 +01:00
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout git repository
|
|
|
|
|
uses: actions/checkout@v4
|
2026-03-30 17:36:47 +02:00
|
|
|
with:
|
|
|
|
|
path: "source"
|
2026-03-15 18:38:59 +01:00
|
|
|
|
2026-03-30 19:00:37 +02:00
|
|
|
- name: Retrieve configs
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
repository: ${{ secrets.CONFIG_REPO }}
|
2026-03-30 19:28:36 +02:00
|
|
|
token: ${{ secrets.CONFIG_REPO_TOKEN }}
|
2026-03-30 19:00:37 +02:00
|
|
|
path: "configs"
|
2026-03-27 23:33:21 +01:00
|
|
|
|
|
|
|
|
- name: Install pnpm
|
2026-03-15 18:38:59 +01:00
|
|
|
uses: pnpm/action-setup@v4
|
|
|
|
|
with:
|
|
|
|
|
version: 10
|
|
|
|
|
|
|
|
|
|
- name: Setup Nodejs
|
|
|
|
|
uses: actions/setup-node@v4
|
2026-03-30 17:50:40 +02:00
|
|
|
with:
|
|
|
|
|
node-version: 22
|
2026-03-15 18:38:59 +01:00
|
|
|
|
2026-03-30 19:00:37 +02:00
|
|
|
- name: Install dependencies and config
|
|
|
|
|
run: |
|
|
|
|
|
cp ./configs/${{ matrix.config_file }} ./source/src/data/content.json
|
|
|
|
|
cd ./source
|
|
|
|
|
pnpm install
|
2026-03-15 18:38:59 +01:00
|
|
|
|
2026-03-27 23:33:21 +01:00
|
|
|
- name: Build the project
|
2026-03-30 22:19:33 +02:00
|
|
|
run: |
|
|
|
|
|
cd ./source
|
|
|
|
|
pnpm run build
|
2026-03-15 18:38:59 +01:00
|
|
|
|
2026-03-27 23:33:21 +01:00
|
|
|
- name: Save the result for deployment
|
2026-03-30 22:36:05 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2026-03-27 23:33:21 +01:00
|
|
|
with:
|
|
|
|
|
name: build-${{ matrix.site }}
|
2026-03-30 22:17:10 +02:00
|
|
|
path: "source/dist/"
|
2026-03-27 23:33:21 +01:00
|
|
|
|
2026-03-15 18:38:59 +01:00
|
|
|
deploy:
|
|
|
|
|
needs: build
|
|
|
|
|
runs-on: docker
|
2026-03-27 23:33:21 +01:00
|
|
|
strategy:
|
2026-03-30 22:41:21 +02:00
|
|
|
matrix:
|
|
|
|
|
include: *site_matrix
|
2026-03-30 22:36:05 +02:00
|
|
|
|
2026-03-15 18:38:59 +01:00
|
|
|
steps:
|
2026-03-30 22:47:47 +02:00
|
|
|
- name: Install Deployment Tools
|
|
|
|
|
run: |
|
|
|
|
|
if command -v apk >/dev/null; then
|
|
|
|
|
apk add --no-cache rsync openssh-client
|
|
|
|
|
else
|
|
|
|
|
apt-get update && apt-get install -y rsync openssh-client
|
|
|
|
|
fi
|
|
|
|
|
|
2026-03-15 18:38:59 +01:00
|
|
|
- name: Setup SSH
|
2026-03-30 23:26:16 +02:00
|
|
|
uses: https://github.com/webfactory/ssh-agent@v0.9.0
|
|
|
|
|
with:
|
|
|
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
2026-03-30 22:36:05 +02:00
|
|
|
|
|
|
|
|
- name: Download Artifact
|
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: build-${{ matrix.site }}
|
|
|
|
|
path: ./dist
|
|
|
|
|
|
2026-03-15 18:38:59 +01:00
|
|
|
- name: Push
|
|
|
|
|
run: |
|
2026-03-30 23:13:28 +02:00
|
|
|
rsync -avz -e "ssh -p ${{ secrets.SERVER_PORT }} -o StrictHostKeyChecking=no" \
|
|
|
|
|
--delete ./dist/ \
|
|
|
|
|
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:${{ matrix.dest }}
|
2026-03-27 23:33:21 +01:00
|
|
|
|
|
|
|
|
notify:
|
|
|
|
|
needs: deploy
|
|
|
|
|
runs-on: docker
|
|
|
|
|
if: always() # Always run
|
|
|
|
|
steps:
|
|
|
|
|
- name: Send Discord Notification
|
2026-03-30 22:41:21 +02:00
|
|
|
run: |
|
|
|
|
|
STATUS="${{ needs.deploy.result }}"
|
|
|
|
|
COLOR=$([ "$STATUS" == "success" ] && echo "48867" || echo "16711680")
|
|
|
|
|
|
|
|
|
|
curl -H "Content-Type: application/json" \
|
|
|
|
|
-X POST \
|
|
|
|
|
-d '{
|
|
|
|
|
"embeds": [{
|
|
|
|
|
"title": "Deployment Report",
|
|
|
|
|
"color": '$COLOR',
|
|
|
|
|
"description": "Status: **'$STATUS'**\nRepo: ${{ github.repository }}\nCommit: ${{ github.sha }}"
|
|
|
|
|
}]
|
|
|
|
|
}' \
|
|
|
|
|
"${{ secrets.DISCORD_WEBHOOK_URL }}"
|
2026-03-27 23:33:21 +01:00
|
|
|
|
|
|
|
|
# For later
|
|
|
|
|
# - name: Send Matrix Notification
|
|
|
|
|
# uses: s707/matrix-action@master
|
|
|
|
|
# with:
|
|
|
|
|
# server_url: https://matrix.org
|
|
|
|
|
# room_id: ${{ secrets.MATRIX_ROOM_ID }}
|
|
|
|
|
# access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
|
|
|
|
|
# message: "Deployment of ${{ gitea.repository }} finished with status: ${{ needs.deploy.result }}"
|