Skip to content

apache init

apache init #163

Workflow file for this run

name: Build DEV
on:
push:
branches-ignore:
- master
jobs:
build:
env:
DEPLOY_USER: gh-dcs-deploy
DEPLOY_HOST: lordvesel.win
RELEASE_DIR: /var/www/dcs-docs/dev/releases/${{ github.ref }}/${{ github.run_number }}
RELEASES_DIR: /var/www/dcs-docs/dev/releases/
CURRENT_DIR: /var/www/dcs-docs/dev/current
runs-on:
- self-hosted
- dcs
if: "contains(github.event.head_commit.message, 'build dev')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build mkdocs
run: |
docker run -e DOCSPATH=dev-docs -i --rm -v $PWD:/build -w /build python:3.10-alpine sh -c 'apk add git gcc linux-headers musl-dev && \
cd ru && pip install -r requirements.txt && \
mkdocs build && \
cd ../en && mkdocs build && \
chown -R 1004:1004 ../'
- name: Deploy
run: |
rm -rf `ls -d ${{env.RELEASES_DIR}}/refs/heads/*/* | grep -v ${{ github.ref }}`
[[ -d ${{env.RELEASE_DIR}}/ru ]] || mkdir -p ${{env.RELEASE_DIR}}/ru
[[ -d ${{env.RELEASE_DIR}}/en ]] || mkdir -p ${{env.RELEASE_DIR}}/en
rsync -a ru/site/ ${{env.RELEASE_DIR}}/ru/
rsync -a en/site/ ${{env.RELEASE_DIR}}/en/
- name: Switch release
run: |
ln -sfn ${{env.RELEASE_DIR}} ${{env.CURRENT_DIR}}
for R in `ls ${{env.RELEASES_DIR}}/${{ github.ref }} | sort -n | head -n -1`
do rm -rf ${{env.RELEASES_DIR}}/${{ github.ref }}/$R
done
- name: Status Success Notification
if: ${{ success() }}
run: |
ntfy -b telegram send "⚡ DCS DOCS: Successfuly deployed DEV branch ${{ github.ref }}.
https://dcs-docs-dev.lordvesel.win/ru/
https://dcs-docs-dev.lordvesel.win/en/"
- name: Status Fail Notification
if: ${{ failure() }}
run: |
ntfy -b telegram send "💩 DCS DOCS: failed to deploy DEV branch ${{ github.ref }}."