Update generated site files #55
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: Deploy site | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
token: ${{ secrets.PUSH_TOKEN }} | |
- name: Set up Python 3.12 | |
uses: actions/[email protected] | |
with: | |
python-version: 3.12 | |
- name: Install Poetry | |
run: curl -sSL https://install.python-poetry.org | python - | |
- name: Install dependencies with Poetry | |
run: poetry install | |
- name: Generate MDX | |
run: poetry run python bin/site.py -v | |
- name: Use Node.js 22.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Export site | |
run: | | |
npm install | |
npm run build | |
working-directory: website | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./website/out | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git config --global push.default simple | |
git add . | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Update generated site files" && git pull --rebase origin main && git push https://x-access-token:${GITHUB_TOKEN}@github.com/magicsword-io/LOLRMM.git HEAD:main) | |
working-directory: website | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |