Refactor workflows

- Update webpack.yml and deploy-docs.yml to use GitHub App tokens
- Ensure consistent token usage for all git operations
- Add proper checkout configuration with fetch-depth
- Standardize environment variables and job structure
- Add timeouts to prevent hanging workflows
- Improve change detection for relevant files
This commit is contained in:
DigiLive committed 2025-05-29 08:56:10 +02:00
1 parent 6a2e64f6ad
commit 95794bf3b8
2 files changed
+51 -28

No files matched your search

+28 -12
View File
@@ -12,19 +12,18 @@ permissions:
contents: write
jobs:
check-for-docs-changes:
name: Check for Docs Changes
check-for-changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
# Output a boolean indicating if any relevant files have changed
docs_changed: ${{ steps.check_files.outputs.any_changed }}
changed: ${{ steps.check_files.outputs.any_changed }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changed files in docs folder or mkdocs.yml
- name: Check for changed documentation files
id: check_files
uses: tj-actions/changed-files@v46
with:
@@ -35,22 +34,39 @@ jobs:
deploy:
name: Deploy MkDocs Site
runs-on: ubuntu-latest
needs: check-for-docs-changes
if: needs.check-for-docs-changes.outputs.docs_changed == 'true'
timeout-minutes: 10
needs: check-for-changes
if: needs.check-for-changes.outputs.changed == 'true'
env:
CI_COMMIT_AUTHOR: 'CI Bot'
CI_COMMIT_EMAIL: 'ci@noreply.github.com'
CI_COMMIT_MESSAGE: 'Continuous Integration - Deploy Documentation'
steps:
- name: Generate GitHub App Token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x' # Use a specific version like '3.10', '3.11', or '3.12'
python-version: '3.x'
- name: Install MkDocs, Material for MkDocs, and PyMdown Extensions
- name: Install MkDocs and dependencies
run: pip install mkdocs mkdocs-material pymdown-extensions
- name: Deploy Docs to GitHub Pages
run: mkdocs gh-deploy --force --clean
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git remote set-url origin https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/DigiLive/mushroom-strategy.git
mkdocs gh-deploy --force --clean --message "${{ env.CI_COMMIT_MESSAGE }}"