Dev #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build STAGE | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
env: | ||
DEPLOY_USER: gh-dcs-deploy | ||
DEPLOY_HOST: lordvesel.win | ||
RELEASE_DIR: /var/www/dcs-docs/stage/releases/${{ github.run_number }} | ||
RELEASES_DIR: /var/www/dcs-docs/stage/releases/ | ||
CURRENT_DIR: /var/www/dcs-docs/stage/current | ||
PRURL: "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number }}" | ||
runs-on: | ||
- self-hosted | ||
- dcs | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: CSS | ||
run: | | ||
export T=$(date +%s) | ||
export CSS=css/materal-add-${T}.css | ||
for L in ru en | ||
do | ||
yq -i '.extra_css[0] = strenv(CSS)' $L/mkdocs.yml | ||
mv $L/docs/css/materal-add.css $L/docs/$CSS | ||
done | ||
- name: Build mkdocs | ||
run: | | ||
docker run -i --rm -v $PWD:/build -w /build python:3.11-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: | | ||
[[ -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: | | ||
Check failure on line 53 in .github/workflows/local-stage.yml GitHub Actions / Build STAGEInvalid workflow file
|
||
ln -sfn ${{env.RELEASE_DIR}} ${{env.CURRENT_DIR}} | ||
for R in `ls ${{env.RELEASES_DIR}} | sort -n | head -n -1` | ||
do rm -rf ${{env.RELEASES_DIR}}$R | ||
done | ||
# - name: Post PR comment on success | ||
# if: ${{ success() }} | ||
# uses: mshick/add-pr-comment@v2 | ||
# with: | ||
# message: | | ||
# 👍 STAGE updated with commit \"${{ github.event.push.head_commit.message }}\" by ${{ github.event.push.pusher }}. | ||
# | ||
# https://dcs-docs-stage.${{env.DEPLOY_HOST}}/ru | ||
# https://dcs-docs-stage.${{env.DEPLOY_HOST}}/en | ||
- name: Status Success Notification | ||
if: ${{ success() }} | ||
run: | | ||
ntfy -b telegram send "⚡ DCS DOCS: Successfuly deployed STAGE ${{env.PRURL}} | ||
https://dcs-docs-stage.lordvesel.win/ru/ | ||
https://dcs-docs-stage.lordvesel.win/en/" | ||
- name: Status Fail Notification | ||
if: ${{ failure() }} | ||
run: | | ||
ntfy -b telegram send "💩 DCS DOCS: Deploy STAGE failed ${{env.PRURL}}." |