@@ -339,3 +339,68 @@ jobs:
339339          replacesArtifacts : true 
340340          token : ${{ secrets.GITHUB_TOKEN }} 
341341          artifacts : " toxcore-nightly-android-${{ matrix.arch }}.tar.gz,toxcore-nightly-android-${{ matrix.arch }}.tar.gz.sha256" 
342+ 
343+   build-wasm :
344+     name : WebAssembly 
345+     needs : [update-nightly-tag] 
346+     runs-on : ubuntu-24.04 
347+     steps :
348+       - name : Set up Docker Buildx 
349+         uses : docker/setup-buildx-action@v3 
350+       - name : Login to DockerHub 
351+         if : ${{ github.event_name == 'push' }} 
352+         uses : docker/login-action@v3 
353+         with :
354+           username : ${{ secrets.DOCKERHUB_USERNAME }} 
355+           password : ${{ secrets.DOCKERHUB_TOKEN }} 
356+       - name : Build and push 
357+         uses : docker/build-push-action@v6 
358+         with :
359+           file : other/docker/wasm/wasm.Dockerfile 
360+           push : ${{ github.event_name == 'push' }} 
361+           tags : toxchat/c-toxcore:wasm 
362+           cache-from : type=registry,ref=toxchat/c-toxcore:wasm 
363+           cache-to : type=inline 
364+           outputs : type=docker 
365+       - name : Extract wasm build 
366+         run : docker run --rm --entrypoint tar toxchat/c-toxcore:wasm -C /wasm/bin -c libtoxcore.js libtoxcore.wasm >toxcore-wasm.tar 
367+       - name : Upload artifacts 
368+         uses : actions/upload-artifact@v4 
369+         with :
370+           name : toxcore-wasm.tar 
371+           path : toxcore-wasm.tar 
372+       - name : Compress tarball 
373+         run : gzip toxcore-wasm.tar 
374+       - name : Get tag name for release file name 
375+         if : contains(github.ref, 'refs/tags/v') 
376+         id : get_version 
377+         run : | 
378+           VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" 
379+           echo "release_tarball=toxcore-$VERSION-wasm.tar.gz" >>$GITHUB_OUTPUT 
380+        - name : Create tarball for release upload 
381+         if : contains(github.ref, 'refs/tags/v') 
382+         run : | 
383+           cp toxcore-wasm.tar.gz "${{ steps.get_version.outputs.release_tarball }}" 
384+        - name : Upload to versioned release 
385+         if : contains(github.ref, 'refs/tags/v') 
386+         uses : ncipollo/release-action@v1 
387+         with :
388+           allowUpdates : true 
389+           draft : true 
390+           token : ${{ secrets.GITHUB_TOKEN }} 
391+           artifacts : " ${{ steps.get_version.outputs.release_tarball }}" 
392+       - name : Create tarball for nightly upload 
393+         run : | 
394+           cp toxcore-wasm.tar.gz toxcore-nightly-wasm.tar.gz 
395+        - name : Upload to nightly release 
396+         uses : ncipollo/release-action@v1 
397+         if : github.event_name == 'push' && github.ref == 'refs/heads/master' 
398+         with :
399+           allowUpdates : true 
400+           tag : nightly 
401+           omitBodyDuringUpdate : true 
402+           omitNameDuringUpdate : true 
403+           prerelease : true 
404+           replacesArtifacts : true 
405+           token : ${{ secrets.GITHUB_TOKEN }} 
406+           artifacts : " toxcore-nightly-wasm.tar.gz" 
0 commit comments