diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be0f91b0f..81c9bccd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -867,3 +867,85 @@ jobs: name: ${{ matrix.name }} ${{ matrix.release_num }} RPM x86_64 path: | imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm + + webassembly-build: + runs-on: ubuntu-24.04 + name: 🌍 Web + permissions: + pages: write + id-token: write + actions: write + steps: + - name: 🧰 Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: 📁 Restore docker /cache + uses: actions/cache@v4 + with: + path: cache + key: web-cache-${{ hashFiles('**/CMakeLists.txt') }} + + - name: 🐳 Inject /cache into docker + uses: reproducible-containers/buildkit-cache-dance@v2 + with: + cache-source: cache + cache-target: /cache + + - name: 🛠️ Build using docker + run: | + docker buildx build . -f dist/web/Dockerfile --progress=plain --build-arg 'JOBS=4' --output out --target raw + + - name: 🔨 Fix permissions + run: | + chmod -c -R +rX "out/" + + - name: ⬆️ Upload artifacts + uses: actions/upload-pages-artifact@v3 + with: + path: out/ + + - name: 🔨 Copy necessary files + run: | + cp dist/web/serve.py out/start_imhex_web.py + + - name: ⬆️ Upload package + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: ImHex Web + path: out/* + + # See https://github.com/actions/cache/issues/342#issuecomment-1711054115 + - name: 🗑️ Delete old cache + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + run: | + gh extension install actions/gh-actions-cache || true + gh actions-cache delete "build-web-cache" --confirm || true + + webassembly-deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + pages: write + id-token: write + actions: write + name: 📃 Deploy to GitHub Pages + runs-on: ubuntu-24.04 + + if: ${{ github.ref == 'refs/heads/master' && github.event.repository.fork == false }} + needs: webassembly-build + + steps: + - name: 🌍 Deploy WebAssembly Build to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + - name: 🗑️ Delete artifact + uses: geekyeggo/delete-artifact@v5 + with: + name: github-pages diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml deleted file mode 100644 index dbe4b3032..000000000 --- a/.github/workflows/build_web.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Build for the web - -on: - push: - branches: - - 'master' - - 'releases/**' - - 'tests/**' - pull_request: - workflow_dispatch: - -env: - BUILD_TYPE: Release - -permissions: - pages: write - id-token: write - actions: write - -jobs: - - build: - runs-on: ubuntu-24.04 - name: 🌍 WebAssembly - steps: - - name: 🧰 Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: 📁 Restore docker /cache - uses: actions/cache@v4 - with: - path: cache - key: web-cache-${{ hashFiles('**/CMakeLists.txt') }} - - - name: 🐳 Inject /cache into docker - uses: reproducible-containers/buildkit-cache-dance@v2 - with: - cache-source: cache - cache-target: /cache - - - name: 🛠️ Build using docker - run: | - docker buildx build . -f dist/web/Dockerfile --progress=plain --build-arg 'JOBS=4' --output out --target raw - - - name: 🔨 Fix permissions - run: | - chmod -c -R +rX "out/" - - - name: ⬆️ Upload artifacts - uses: actions/upload-pages-artifact@v3 - with: - path: out/ - - - name: 🔨 Copy necessary files - run: | - cp dist/web/serve.py out/start_imhex_web.py - - - name: ⬆️ Upload package - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: ImHex Web - path: out/* - - # See https://github.com/actions/cache/issues/342#issuecomment-1711054115 - - name: 🗑️ Delete old cache - continue-on-error: true - env: - GH_TOKEN: ${{ github.token }} - run: | - gh extension install actions/gh-actions-cache || true - gh actions-cache delete "build-web-cache" --confirm || true - - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - name: 📃 Deploy to GitHub Pages - runs-on: ubuntu-24.04 - - if: ${{ github.ref == 'refs/heads/master' && github.event.repository.fork == false }} - needs: build - - steps: - - name: 🌍 Deploy - id: deployment - uses: actions/deploy-pages@v4 - - - name: 🗑️ Delete artifact - uses: geekyeggo/delete-artifact@v5 - with: - name: github-pages \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 356e243e8..ac241ea80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -117,6 +117,7 @@ jobs: run: | mv "Windows Portable x86_64.zip" imhex-${{ env.IMHEX_VERSION }}-Windows-Portable-x86_64.zip mv "Windows Portable NoGPU x86_64.zip" imhex-${{ env.IMHEX_VERSION }}-Windows-Portable-NoGPU-x86_64.zip + mv "ImHex Web.zip" imhex-${{ env.IMHEX_VERSION }}-web.zip - name: ⬆️ Upload everything to release uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981