Finished build.yml addition for CSS selector obfuscator

This commit is contained in:
SwingTheVine 2025-07-29 06:15:42 -04:00
parent 97ba324457
commit e6967517b7

View file

@ -7,6 +7,27 @@ on:
jobs:
# Updates the Auto branch to match Main
update-auto:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Update Auto To Main
run: |
git fetch origin
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git checkout auto || git checkout -b auto
git reset --hard origin/main
git push --force origin auto
# Builds the code
# This is bundling, obfuscating, version bumping, etc.
build:
@ -15,6 +36,11 @@ jobs:
runs-on: ubuntu-latest
needs: [update-auto] # Needs the update-auto job to finish first
outputs:
msg: ${{ steps.get-commit-message.outputs.MSG }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@ -65,14 +91,63 @@ jobs:
id: get-commit-message
run: echo "MSG=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT
# This should happen on 'auto' branch
- name: Commit and push built script
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git checkout auto || git checkout -b auto
git add dist/*
git add src/BlueMarble.meta.js
git add package.json
git add docs/README.md
git commit -m "Bumped version; ${{ steps.get-commit-message.outputs.MSG }}" || echo "No changes to commit"
git push
# Updates the requirement link SHA
update-requirements:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [update-auto, build] # Needs the update-auto and build jobs to finish first
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: auto # Checks out the auto branch
fetch-depth: 0
- name: Get SHA of origin/auto
run: |
git fetch origin auto
AUTO_SHA=$(git rev-parse origin/auto)
echo "Auto SHA: $AUTO_SHA"
echo "AUTO_SHA=$AUTO_SHA" >> $GITHUB_ENV
- name: Update Resource Link SHA
run: |
sed -i "/@resource/ s/sha=[a-f0-9]\{40\}/sha=${AUTO_SHA}/g" dist/BlueMarble.user.js src/BlueMarble.meta.js
echo "Updated resourceLinkSHA:"
- name: Commit Resource Link SHA
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add dist/BlueMarble.user.js
git add src/BlueMarble.meta.js
git commit -m "Merge version; ${{ needs.build.outputs.MSG }}" || echo "No changes to commit"
git push
- name: Merge Auto -> Main
run: |
git fetch origin
git checkout origin/main -B main
git merge --squash origin/auto
git commit -m "Release version; ${{ needs.build.outputs.MSG }}" || echo "No changes to commit"
git push origin main