forked from DigiLive/mushroom-strategy
Refactor Workflows
This commit is contained in:
30
.github/workflows/deploy-docs.yml
vendored
30
.github/workflows/deploy-docs.yml
vendored
@@ -4,16 +4,36 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
|
||||||
- 'docs/**'
|
|
||||||
- 'mkdocs.yml'
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
check-for-docs-changes:
|
||||||
|
name: Check for Docs Changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
# Output a boolean indicating if any relevant files have changed
|
||||||
|
docs_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
|
||||||
|
id: check_files
|
||||||
|
uses: tj-actions/changed-files@v40
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
docs/**
|
||||||
|
mkdocs.yml
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy MkDocs Site
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check-for-docs-changes
|
||||||
|
if: needs.check-for-docs-changes.outputs.docs_changed == 'true'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
@@ -29,3 +49,5 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy Docs to GitHub Pages
|
- name: Deploy Docs to GitHub Pages
|
||||||
run: mkdocs gh-deploy --force --clean
|
run: mkdocs gh-deploy --force --clean
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
39
.github/workflows/webpack.yml
vendored
39
.github/workflows/webpack.yml
vendored
@@ -2,12 +2,30 @@ name: Build distribution with Webpack
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches:
|
||||||
paths:
|
- main
|
||||||
- 'src/**'
|
|
||||||
- 'webpack.config.js'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
detect-source-changes:
|
||||||
|
name: Detect Source Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
source_changed: ${{ steps.check_files.outputs.any_changed }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Check for changed files in src or webpack.config.js
|
||||||
|
id: check_files
|
||||||
|
uses: tj-actions/changed-files@v40
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
src/**
|
||||||
|
webpack.config.js
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build Distribution
|
name: Build Distribution
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -22,7 +40,9 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
node-version: [22.x]
|
node-version: [22.x]
|
||||||
|
|
||||||
# Checkout Repository
|
needs: detect-source-changes
|
||||||
|
if: needs.detect-source-changes.outputs.source_changed == 'true'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -42,16 +62,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: Check for file changes
|
|
||||||
id: checkDiff
|
|
||||||
run: |
|
|
||||||
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Commit and push all changed files.
|
|
||||||
# Must only affect files that are listed in "paths-ignore".
|
|
||||||
- name: Commit Distribution Build
|
- name: Commit Distribution Build
|
||||||
# Only run on a main branch push (e.g., pull request merge).
|
|
||||||
if: github.event_name == 'push' && steps.checkDiff.outputs.changed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
||||||
git config --global user.email "ci_activity@noreply.github.com"
|
git config --global user.email "ci_activity@noreply.github.com"
|
||||||
|
@@ -45,4 +45,3 @@ engage with the community!
|
|||||||
⭐ [star on GitHub](https://github.com/DigiLive/mushroom-strategy) and exploring ways
|
⭐ [star on GitHub](https://github.com/DigiLive/mushroom-strategy) and exploring ways
|
||||||
to ❤️ [sponsor the project](https://github.com/sponsors/DigiLive) to support its continued development! Your support
|
to ❤️ [sponsor the project](https://github.com/sponsors/DigiLive) to support its continued development! Your support
|
||||||
helps us grow and improve.
|
helps us grow and improve.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user