Skip to content

Commit

Permalink
extract gh pages to its own thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
nbittich committed Feb 10, 2024
1 parent 1f94ae5 commit a4efb7d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 34 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/gh-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release WASM

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
on:
push:
branches:
- "master"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu
- name: Build
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack build --target web --release --scope nbittich ./adana-script-wasm
mkdir ghPages
cp -r ./adana-script-wasm/pkg ghPages
cp ./adana-playground/app.js ghPages
cp ./adana-playground/style.css ghPages
cp ./adana-playground/favicon.ico ghPages
cp ./adana-playground/examples.js ghPages
cp ./adana-playground/index.html ghPages
- name: Upload ghPages
uses: actions/upload-artifact@v4
with:
name: ghPages
path: ghPages
gh-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Download ghPages
uses: actions/download-artifact@v4
with:
name: ghPages
path: "_site/"
- name: Upload pages
uses: actions/upload-pages-artifact@v3
- name: Deploy pages
uses: actions/deploy-pages@v4
34 changes: 0 additions & 34 deletions .github/workflows/release-wasm.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
name: Release WASM

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
on:
push:
tags:
- "**[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand All @@ -29,24 +23,12 @@ jobs:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack build --target web --release --scope nbittich ./adana-script-wasm
wasm-pack pack ./adana-script-wasm/pkg
mkdir ghPages
cp -r ./adana-script-wasm/pkg ghPages
cp ./adana-playground/app.js ghPages
cp ./adana-playground/style.css ghPages
cp ./adana-playground/favicon.ico ghPages
cp ./adana-playground/examples.js ghPages
cp ./adana-playground/index.html ghPages
- name: Upload pkg
uses: actions/upload-artifact@v4
with:
name: pkg
path: adana-script-wasm/pkg
- name: Upload ghPages
uses: actions/upload-artifact@v4
with:
name: ghPages
path: ghPages
publish:
needs: build
runs-on: ubuntu-latest
Expand All @@ -68,19 +50,3 @@ jobs:
cd pkg
npm install
npm publish --access public
gh-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Download ghPages
uses: actions/download-artifact@v4
with:
name: ghPages
path: "_site/"
- name: Upload pages
uses: actions/upload-pages-artifact@v3
- name: Deploy pages
uses: actions/deploy-pages@v4

0 comments on commit a4efb7d

Please sign in to comment.