rename v to lower-case #755
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: Build and Deploy WebAssembly | |
on: | |
push: | |
branches: | |
- next-generation-ts | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Bun | |
run: | | |
curl -fsSL https://bun.sh/install | bash | |
echo "$HOME/.bun/bin" >> $GITHUB_PATH | |
export PATH="$HOME/.bun/bin:$PATH" | |
bun --version | |
- name: Setup GIT config | |
run: | | |
git clone https://github.com/SalamLang/Salam-Editor.git | |
git config --global user.name "Max Base (Salam)" | |
git config --global user.email "$EMAIL" | |
- name: Run WebAssembly build script | |
run: | | |
cd src | |
bunx esbuild main.ts --bundle --platform=browser --outfile=../salam-wa.js --external:fs --external:path | |
cd .. | |
bunx terser salam-wa.js --compress --mangle -o salam-wa.js | |
bunx javascript-obfuscator salam-wa.js --output salam-wa.js --compact true --control-flow-flattening true | |
- name: Calculate checksums of original files | |
id: original_checksums | |
run: | | |
ls -l salam-wa.js | |
sha256sum salam-wa.js > js-checksum.txt || echo "Error calculating checksum for salam-wa.js" | |
echo "JS_CHECKSUM=$(cat js-checksum.txt | awk '{ print $1 }')" >> $GITHUB_ENV | |
- name: Calculate checksums of new files in Salam-Editor | |
id: new_checksums | |
run: | | |
cd .. | |
cd Salam-Editor | |
git checkout dev | |
cd src/scripts/ | |
ls -l salam-wa.js | |
sha256sum salam-wa.js > js-checksum-editor.txt || echo "Error calculating checksum for salam-wa.js" | |
echo "JS_CHECKSUM_EDITOR=$(cat js-checksum-editor.txt | awk '{ print $1 }')" >> $GITHUB_ENV | |
- name: Commit and push changes if needed | |
if: ${{ env.JS_CHECKSUM != env.JS_CHECKSUM_EDITOR }} | |
run: | | |
cp ./salam-wa.js ./Salam-Editor/src/scripts/ | |
cd Salam-Editor | |
sudo chown -R www-data:www-data * | |
git add src/scripts/salam-wa.js | |
git commit -m "Release: Update WebAssembly files" | |
git push https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/SalamLang/Salam-Editor.git |