Skip to content

Commit

Permalink
Update web-assembly.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax authored Sep 16, 2024
1 parent 4a9a3c6 commit a677549
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions .github/workflows/web-assembly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,40 +57,34 @@ jobs:
sudo chown www-data:www-data *
git config user.name "Max Base"
git config user.email "$EMAIL"
git config user.name "Max Base"
git config user.email "${{ secrets.USER_EMAIL }}"
- name: Calculate checksums of original files
id: original_checksums
run: |
cd src
sha256sum salam-wa.js > js-checksum.txt
sha256sum salam-wa.wasm > wasm-checksum.txt
echo "JS_CHECKSUM=$(cat js-checksum.txt)" >> $GITHUB_ENV
echo "WASM_CHECKSUM=$(cat wasm-checksum.txt)" >> $GITHUB_ENV
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
sha256sum salam-wa.js > js-checksum-editor.txt || echo ""
sha256sum salam-wa.wasm > wasm-checksum-editor.txt || echo ""
echo "JS_CHECKSUM_EDITOR=$(cat js-checksum-editor.txt)" >> $GITHUB_ENV
echo "WASM_CHECKSUM_EDITOR=$(cat wasm-checksum-editor.txt)" >> $GITHUB_ENV
- name: Check if files differ
id: check_changes
run: |
if [ "$JS_CHECKSUM" != "$JS_CHECKSUM_EDITOR" ] || [ "$WASM_CHECKSUM" != "$WASM_CHECKSUM_EDITOR" ]; then
echo "CHANGED=true" >> $GITHUB_ENV
else
echo "CHANGED=false" >> $GITHUB_ENV
fi
sha256sum salam-wa.js > js-checksum-editor.txt || echo "0 salam-wa.js" > js-checksum-editor.txt
sha256sum salam-wa.wasm > wasm-checksum-editor.txt || echo "0 salam-wa.wasm" > wasm-checksum-editor.txt
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 if changes detected
if: ${{ env.CHANGED == 'true' }}
- name: Commit and push changes if needed
if: ${{ env.JS_CHECKSUM != env.JS_CHECKSUM_EDITOR || env.WASM_CHECKSUM != env.WASM_CHECKSUM_EDITOR }}
run: |
cd Salam-Editor
git config user.name "Max Base"
git config user.email "${{ secrets.USER_EMAIL }}"
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

0 comments on commit a677549

Please sign in to comment.