Skip to content

Deloy GitHub Pages

Deloy GitHub Pages #61

Workflow file for this run

name: 'Deloy GitHub Pages'
on:
workflow_run:
workflows: ["Build (Dev)"]
types:
- completed
workflow_dispatch:
jobs:
get-version-number:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Get version number"
id: get_version
run: |
export VERSION=$(python -c 'print(__import__("version").VERSION)')
export SUB_VER=$(git rev-list --no-merges --count $(git describe --tags --abbrev=0)..HEAD)
echo "Currect Version Number: $VERSION.$SUB_VER"
echo "SUB_VER = $SUB_VER" >> version.py
# Create an environment file
echo "VERSION=${VERSION}.${SUB_VER}" >> $GITHUB_OUTPUT
echo "SUB_VERSION=${SUB_VER}" >> $GITHUB_OUTPUT
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
SUB_VERSION: ${{ steps.get_version.outputs.SUB_VERSION }}
deloy:
needs: get-version-number
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Update Pages File"
run: |
curl -o docs/public/artifacts.json https://api.github.com/repos/ITCraftDevelopmentTeam/OneDisc/actions/runs/$RUN_ID/artifacts
curl -o docs/public/release.json https://api.github.com/repos/ITCraftDevelopmentTeam/OneDisc/releases/latest
STABLE_VERSION=$(cat docs/public/release.json | grep tag_name | awk -F\" '{print $4}' | awk -Fv '{print $2}')
echo "{\"beta\": \"$BETA_VERSION\", \"stable\": \"$(echo $STABLE_VERSION).0\"}" > docs/public/version.json
env:
RUN_ID: ${{ github.event.workflow_run.id }}
BETA_VERSION: ${{ needs.get-version-number.outputs.VERSION }}
- name: "Set up Node.js"
uses: actions/setup-node@v4
with:
node-version: '21'
registry-url: 'https://registry.npmjs.org/'
- name: Install requirements
run: |
npm install
- name: Build Documents
run: |
npm run docs:build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vitepress/dist/