Update build-release.yml - fix https://github.com/SalamLang/Salam/act… #113
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: | |
- main | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache Emscripten SDK | |
uses: actions/cache@v4 | |
with: | |
path: emsdk | |
key: ${{ runner.os }}-emsdk-${{ hashFiles('emsdk/.emscripten') }} | |
restore-keys: | | |
${{ runner.os }}-emsdk- | |
- name: Install Emscripten (if not cached) | |
run: | | |
if [ ! -d "emsdk" ]; then | |
git clone https://github.com/emscripten-core/emsdk.git | |
fi | |
cd emsdk | |
./emsdk install latest | |
./emsdk activate latest | |
- name: Source Emscripten environment | |
run: | | |
echo "EMSDK=/home/runner/work/Salam/Salam/emsdk" >> $GITHUB_ENV | |
echo "PATH=$PATH:/home/runner/work/Salam/Salam/emsdk:/home/runner/work/Salam/Salam/emsdk/upstream/emscripten" >> $GITHUB_ENV | |
source ./emsdk/emsdk_env.sh | |
- name: Run WebAssembly build script | |
run: | | |
source emsdk/emsdk_env.sh | |
cd src | |
bash build-webassembly.sh | |
- name: Clone Salam-Editor repository | |
run: | | |
FIRST_NAME="Max" | |
DOMAIN="gmail.com" | |
EMAIL="${FIRST_NAME}BaseCode@${DOMAIN}" | |
git clone https://github.com/SalamLang/Salam-Editor.git | |
cp ./src/salam-wa.js ./Salam-Editor/ | |
cp ./src/salam-wa.wasm ./Salam-Editor/ | |
cd Salam-Editor | |
sudo chown www-data:www-data * | |
git config user.name "Max Base" | |
git config user.email "$EMAIL" | |
- name: Check for changes in WebAssembly files | |
run: | | |
cd Salam-Editor | |
git diff --exit-code salam-wa.js salam-wa.wasm | |
continue-on-error: true | |
- name: Commit and push if changes detected | |
if: ${{ steps.check-for-changes.outcome == 'failure' }} | |
run: | | |
git add salam-wa.js salam-wa.wasm | |
git commit -m "Release: Update WebAssembly files" | |
git push https://x-access-token:${{ secrets.USER_TOKEN }}@github.com/SalamLang/Salam-Editor.git |