[webUI] popup to indicate preselected tweaks #261
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: Checks | |
on: | |
push: | |
branches: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
format_repo: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} # Make sure PR is checked out | |
- name: Install Prettier | |
run: npm install prettier | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Create Virtual Environment | |
run: python -m venv venv | |
- name: Install dependencies | |
run: | | |
source venv/bin/activate | |
python -m pip install clrprint markdown beautifulsoup4 ujson | |
- name: Run pre_commit.py | |
run: python pys/pre_commit.py --format | |
- name: Commit changes | |
run: | | |
git config --global user.name "NSPBot911" | |
git config --global user.email ${{ secrets.BOT_EMAIL }} | |
git add -A | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit" | |
else | |
git commit -m "[actions] Post Commit Checks Completed" -m "$(git log -1 --pretty=format:'%an') forgot to run pre_commit.py --format" -m "skip-checks: true" | |
git push | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
deploy_page: | |
needs: format_repo | |
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'skip-deploy') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Replace server IP in JavaScript | |
run: | | |
sed -i 's|const serverip = "localhost";|const serverip = "${{ secrets.IP_FOR_SERVER }}";|g' webUI/app.js | |
- name: Deploy to GitHub Pages | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
target_branch: gh-pages | |
build_dir: ./webUI | |
author: NSPBot911 <${{ secrets.BOT_EMAIL }}> | |
committer: NSPBot911 <${{ secrets.BOT_EMAIL }}> | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
update_server: | |
needs: deploy_page | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'skip-update') && contains(github.event.head_commit.message, 'pack') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get latest commit title | |
id: get_commit | |
run: | | |
echo "commit_title=$(git log -1 --pretty=%s)" >> $GITHUB_ENV | |
- name: Trigger server-backend workflow | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.BOT_TOKEN }}" \ | |
https://api.github.com/repos/BEComTweaks/server-backend/actions/workflows/106751072/dispatches \ | |
-d "{\"ref\":\"main\", \"inputs\":{\"title\":\"resource-packs: ${{ env.commit_title }}\"}}" |