Deploy auf live: docs.tibicms.de per Repo-Token-Rsync
Deploy tibi-docs / build-and-deploy (push) Successful in 27s
Deploy tibi-docs / build-and-deploy (push) Successful in 27s
- Workflow auf master-only reduziert: build + rsync ./dist/ (kein Registry/Staging) - rsync-Ziel ueber RSYNC_PATH=docs.tibicms.de (Docroot ab htdocs), User Repo+Subdomain-ID - sshpass -e statt Passwort im Kommando - astro site-URL auf https://docs.tibicms.de umgestellt (Sitemap/Canonical) - docker-compose-staging.yml entfernt (Staging raus)
This commit is contained in:
1 parent
5d9abe4dc9
commit
bda5d80180
4 files changed
+29
-50
No files matched your search
+26
-40
@@ -1,9 +1,14 @@
|
|||||||
name: Deploy tibi-docs
|
name: Deploy tibi-docs
|
||||||
|
|
||||||
|
# Statischer Starlight-Build, Auslieferung als Dateien über Apache.
|
||||||
|
# Push auf master -> Build -> rsync nach htdocs/<RSYNC_PATH>/ auf ftp1.webmakers.de.
|
||||||
|
# Auth: Repo-Token (github.token) + Basispanel-Subdomain docs.tibicms.de (ID 2216,
|
||||||
|
# gitbaseRepository=cms/tibi-docs). Der rsync-User landet in htdocs des Kunden;
|
||||||
|
# weiter runter kommt man nicht, deshalb ist RSYNC_PATH der Docroot-Pfad ab htdocs.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -12,78 +17,59 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: gitbase.de/actions/ubuntu:latest
|
image: gitbase.de/actions/ubuntu:latest
|
||||||
volumes:
|
|
||||||
- /data:/data
|
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: "true"
|
FORCE_COLOR: "true"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
lfs: true
|
lfs: true
|
||||||
submodules: false
|
submodules: false
|
||||||
|
|
||||||
- name: setup-node
|
- name: setup-node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: install-dependencies
|
- name: install-dependencies
|
||||||
run: npm install
|
run: npm ci
|
||||||
|
|
||||||
- name: build-static
|
- name: build-static
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: build-and-push-image
|
- name: check-static-build
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
|
||||||
env:
|
|
||||||
REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }}
|
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
image="gitbase.de/${{ github.repository }}"
|
test -f dist/index.html
|
||||||
|
test -f dist/404.html
|
||||||
if [ "${{ github.ref_name }}" = "dev" ]; then
|
test -d dist/pagefind
|
||||||
image="${image}:dev"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "${REGISTRY_PASS}" | docker login gitbase.de -u tibibot --password-stdin
|
|
||||||
docker build -t "$image" . --pull
|
|
||||||
docker push "$image"
|
|
||||||
|
|
||||||
- name: deploy-staging
|
|
||||||
if: github.ref == 'refs/heads/dev'
|
|
||||||
env:
|
|
||||||
COMPOSE_PROJECT_NAME: ${{ github.repository }}-${{ github.ref_name }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
set -o allexport
|
|
||||||
. ./.env
|
|
||||||
set +o allexport
|
|
||||||
|
|
||||||
COMPOSE_PROJECT_NAME=$(echo "$COMPOSE_PROJECT_NAME" | sed 's+/+-+g')
|
|
||||||
|
|
||||||
docker compose -f docker-compose-staging.yml -p $COMPOSE_PROJECT_NAME up -d --build --remove-orphans
|
|
||||||
|
|
||||||
|
# .env ist gitignored -> Zielwerte stehen hier direkt (keine Secrets).
|
||||||
|
# RSYNC_USER = Repo + Basispanel-Subdomain-ID, RSYNC_PATH = Docroot ab htdocs.
|
||||||
- name: deploy-live
|
- name: deploy-live
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
env:
|
env:
|
||||||
RSYNC_USER: ${{ github.repository }}
|
RSYNC_USER: ${{ github.repository }},2216
|
||||||
RSYNC_PASS: ${{ github.token }}
|
RSYNC_PASS: ${{ github.token }}
|
||||||
|
RSYNC_HOST: ftp1.webmakers.de
|
||||||
|
RSYNC_PORT: "22223"
|
||||||
|
RSYNC_PATH: docs.tibicms.de
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
set -o allexport
|
|
||||||
. ./.env
|
|
||||||
set +o allexport
|
|
||||||
|
|
||||||
: "${RSYNC_USER:?RSYNC_USER missing}"
|
: "${RSYNC_USER:?RSYNC_USER missing}"
|
||||||
: "${RSYNC_PASS:?RSYNC_PASS missing}"
|
: "${RSYNC_PASS:?RSYNC_PASS missing}"
|
||||||
: "${RSYNC_HOST:?RSYNC_HOST missing}"
|
: "${RSYNC_HOST:?RSYNC_HOST missing}"
|
||||||
: "${RSYNC_PORT:?RSYNC_PORT missing}"
|
: "${RSYNC_PORT:?RSYNC_PORT missing}"
|
||||||
|
: "${RSYNC_PATH:?RSYNC_PATH missing}"
|
||||||
|
|
||||||
SSH_CMD="sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${RSYNC_PORT} -l ${RSYNC_USER}"
|
echo "Deploying to ${RSYNC_HOST}:${RSYNC_PATH} on port ${RSYNC_PORT} as ${RSYNC_USER}"
|
||||||
|
|
||||||
|
export SSHPASS="${RSYNC_PASS}"
|
||||||
|
SSH_CMD="sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${RSYNC_PORT} -l ${RSYNC_USER}"
|
||||||
|
|
||||||
rsync -rlcgD --perms -i -u -v --stats --progress \
|
rsync -rlcgD --perms -i -u -v --stats --progress \
|
||||||
--delete \
|
--delete \
|
||||||
-e "${SSH_CMD}" \
|
-e "${SSH_CMD}" \
|
||||||
--exclude=.git \
|
--exclude=.git \
|
||||||
./dist/ ${RSYNC_USER}@${RSYNC_HOST}:htdocs/
|
./dist/ "${RSYNC_HOST}":"./${RSYNC_PATH}/"
|
||||||
+2
-1
@@ -4,10 +4,11 @@ import starlight from '@astrojs/starlight';
|
|||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://tibi-docs.code.testversion.online',
|
site: 'https://docs.tibicms.de',
|
||||||
vite: {
|
vite: {
|
||||||
server: {
|
server: {
|
||||||
allowedHosts: [
|
allowedHosts: [
|
||||||
|
'docs.tibicms.de',
|
||||||
'tibi-docs.code.testversion.online',
|
'tibi-docs.code.testversion.online',
|
||||||
'localhost',
|
'localhost',
|
||||||
'127.0.0.1',
|
'127.0.0.1',
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
services:
|
|
||||||
www:
|
|
||||||
build: .
|
|
||||||
image: ${PROJECT_NAME}:dev
|
|
||||||
container_name: dev-${PROJECT_NAME}
|
|
||||||
labels:
|
|
||||||
traefik.enable: "true"
|
|
||||||
online.testversion.staging.subdomain: dev-${PROJECT_NAME}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"generatedAt": "2026-10-20T01:44:24.935Z",
|
"generatedAt": "2026-10-20T13:50:25.234Z",
|
||||||
"stats": {
|
"stats": {
|
||||||
"files": 70,
|
"files": 70,
|
||||||
"byDir": {
|
"byDir": {
|
||||||
|
|||||||
Reference in new issue
Block a user