Files
ReaderJS/.github/workflows/update-submodules.yml
T

67 lines
1.9 KiB
YAML

name: Monthly Submodule Update
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- name: Update submodules to latest
run: git submodule update --remote --merge
- name: Sync public assets from submodules
run: cp submodules/JSDoc/src/docToText.js public/jsdoc/docToText.js
- name: Check for changes
id: changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [ -z "$(git status --porcelain)" ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit and push
if: steps.changes.outputs.changed == 'true'
run: |
git add -A
git commit -m "chore: monthly submodule update $(date +%Y-%m)"
git push
- name: Build release artifact
if: steps.changes.outputs.changed == 'true'
run: |
npx vite build --base /ReaderJS/
cd dist && zip -r ../release.zip . && cd ..
- name: Create GitHub release
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v$(date +%Y.%m)"
gh release create "$TAG" release.zip \
--title "Monthly Update $(date +%Y-%m)" \
--notes "Automated monthly submodule update. Submodules updated to their latest commits; bundled assets refreshed." \
--latest