Initial: Tibi-Doku auf Starlight-Basis (Nova-Theme, Docker-Stack, Sync-Skripte)
This commit is contained in:
commit
58502aa3c8
78 files changed
+22860
No files matched your search
@@ -0,0 +1,89 @@
|
||||
name: Deploy tibi-docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: build-and-deploy
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: gitbase.de/actions/ubuntu:latest
|
||||
volumes:
|
||||
- /data:/data
|
||||
env:
|
||||
FORCE_COLOR: "true"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
lfs: true
|
||||
submodules: false
|
||||
|
||||
- name: setup-node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: install-dependencies
|
||||
run: npm install
|
||||
|
||||
- name: build-static
|
||||
run: npm run build
|
||||
|
||||
- name: build-and-push-image
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
||||
env:
|
||||
REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }}
|
||||
run: |
|
||||
set -eu
|
||||
image="gitbase.de/${{ github.repository }}"
|
||||
|
||||
if [ "${{ github.ref_name }}" = "dev" ]; then
|
||||
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
|
||||
|
||||
- name: deploy-live
|
||||
if: github.ref == 'refs/heads/master'
|
||||
env:
|
||||
RSYNC_USER: ${{ github.repository }}
|
||||
RSYNC_PASS: ${{ github.token }}
|
||||
run: |
|
||||
set -eu
|
||||
set -o allexport
|
||||
. ./.env
|
||||
set +o allexport
|
||||
|
||||
: "${RSYNC_USER:?RSYNC_USER missing}"
|
||||
: "${RSYNC_PASS:?RSYNC_PASS missing}"
|
||||
: "${RSYNC_HOST:?RSYNC_HOST missing}"
|
||||
: "${RSYNC_PORT:?RSYNC_PORT missing}"
|
||||
|
||||
SSH_CMD="sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${RSYNC_PORT} -l ${RSYNC_USER}"
|
||||
|
||||
rsync -rlcgD --perms -i -u -v --stats --progress \
|
||||
--delete \
|
||||
-e "${SSH_CMD}" \
|
||||
--exclude=.git \
|
||||
./dist/ ${RSYNC_USER}@${RSYNC_HOST}:htdocs/
|
||||
Reference in new issue
Block a user