on: push: branches: - main - develop stages: - build env: PUBLISH_BRANCH: ${{ github.ref == 'refs/heads/main' && 'pages' || 'draft' }} BUILD_STRICT: ${{ github.ref == 'refs/heads/main' && '--strict' || '' }} DRAFT_PRIMARY_COLOR: orange DRAFT_ACCENT_COLOR: deep orange jobs: build: runs-on: docker container: image: git.lordwektabyte.cat/lordwektabyte/node-pip:latest steps: - uses: https://code.forgejo.org/actions/checkout@v4 with: fetch-depth: 0 - run: git config user.email "lordwektabyte@duck.com" - run: git config user.name "lordwektabyte" - run: pip install -r requirements.txt - run: | if [ "$PUBLISH_BRANCH" != "pages" ]; then sed -i "0,/^\([[:space:]]*primary: *\).*/s//\1$DRAFT_PRIMARY_COLOR/;0,/\([[:space:]]*accent: *\).*/s//\1$DRAFT_ACCENT_COLOR/;" mkdocs.yml fi - run: mkdocs build --verbose --site-dir public $BUILD_STRICT - run: | if [ "$PUBLISH_BRANCH" != "pages" ]; then git restore mkdocs.yml fi - run: cp .domains public/.domains - uses: actions/upload-artifact@v3 with: name: mkdocs-publish path: public - run: git switch --orphan $PUBLISH_BRANCH - run: git add public - run: git mv public/* public/.domains . - run: git commit -m "Mkdocs Build" - run: git push -u origin $PUBLISH_BRANCH -f