This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
Merge pull request #10 from Yuhanawa/Allnew #218
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: Update Versions and Upload to Releases Branch | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
update-and-release: | |
if: ${{ github.actor != 'github-actions[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
run_install: true | |
- name: Update versions | |
run: pnpm run update-versions | |
- name: Build | |
run: pnpm run build | |
- name: Configure Git | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Check for changes in userscripts | |
id: check_changes | |
run: | | |
git add userscripts | |
if git diff --staged --quiet; then | |
echo "has_changes=false" >> $GITHUB_OUTPUT | |
else | |
echo "has_changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and push to master | |
if: steps.check_changes.outputs.has_changes == 'true' | |
run: | | |
git commit -m "ci: Update versions" | |
git push origin master | |
- name: Create and push to releases branch | |
run: | | |
git checkout --orphan releases | |
git rm -rf . | |
if [ ! -d "dist/userscripts" ]; then | |
echo "Error: dist/userscripts directory not found" >&2 | |
exit 1 | |
fi | |
git add dist | |
git commit -m "ci: Update release files" | |
git push origin releases --force |