Skip to content

Bump super-linter/super-linter from 7.2.0 to 7.2.1 (#400) #456

Bump super-linter/super-linter from 7.2.0 to 7.2.1 (#400)

Bump super-linter/super-linter from 7.2.0 to 7.2.1 (#400) #456

Workflow file for this run

name: Build and Deploy WebAssembly
on:
push:
branches:
- main
permissions:
contents: write
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: Install Node.js and npx
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs npm
npx --version
- name: Cache apt package manager's archives
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-cache-${{ hashFiles('**/apt-packages-list.txt') }}
restore-keys: |
${{ runner.os }}-apt-cache-
- 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
- name: Run WebAssembly build script
run: |
chmod +x emsdk/emsdk_env.sh
source emsdk/emsdk_env.sh
chmod +x build-webassembly.sh
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
git config --global user.name "Max Base (Salam)"
git config --global user.email "$EMAIL"
- name: Calculate checksums of original files
id: original_checksums
run: |
ls -l salam-wa.js salam-wa.wasm
sha256sum salam-wa.js > js-checksum.txt || echo "Error calculating checksum for salam-wa.js"
sha256sum salam-wa.wasm > wasm-checksum.txt || echo "Error calculating checksum for salam-wa.wasm"
echo "JS_CHECKSUM=$(cat js-checksum.txt | awk '{ print $1 }')" >> $GITHUB_ENV
echo "WASM_CHECKSUM=$(cat wasm-checksum.txt | awk '{ print $1 }')" >> $GITHUB_ENV
- name: Calculate checksums of new files in Salam-Editor
id: new_checksums
run: |
cd Salam-Editor
ls -l salam-wa.js salam-wa.wasm
sha256sum salam-wa.js > js-checksum-editor.txt || echo "Error calculating checksum for salam-wa.js"
sha256sum salam-wa.wasm > wasm-checksum-editor.txt || echo "Error calculating checksum for salam-wa.wasm"
echo "JS_CHECKSUM_EDITOR=$(cat js-checksum-editor.txt | awk '{ print $1 }')" >> $GITHUB_ENV
echo "WASM_CHECKSUM_EDITOR=$(cat wasm-checksum-editor.txt | awk '{ print $1 }')" >> $GITHUB_ENV
- name: Commit and push changes if needed
if: ${{ env.JS_CHECKSUM != env.JS_CHECKSUM_EDITOR || env.WASM_CHECKSUM != env.WASM_CHECKSUM_EDITOR }}
run: |
cp ./salam-wa.js ./Salam-Editor/
cp ./salam-wa.wasm ./Salam-Editor/
cd Salam-Editor
sudo chown -R www-data:www-data *
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