-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to publish web assembly
- Loading branch information
1 parent
61c4235
commit df8c2f3
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request_target: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
native: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
submodules: recursive | ||
- name: Add base repo to git config | ||
run: git remote add upstream ${{ github.event.pull_request.base.repo.html_url }} | ||
if: startsWith(github.event_name, 'pull_request') | ||
|
||
- uses: lukka/get-cmake@latest | ||
|
||
- name: Run CMake+vcpkg to build packages. | ||
uses: lukka/run-cmake@v10 | ||
with: | ||
configurePreset: 'ninja-multi-vcpkg' | ||
buildPreset: 'ninja-multi-vcpkg-release' | ||
|
||
web: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
EMSDK: '/tmp/emsdk' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
submodules: recursive | ||
- name: Add base repo to git config | ||
run: git remote add upstream ${{ github.event.pull_request.base.repo.html_url }} | ||
if: startsWith(github.event_name, 'pull_request') | ||
|
||
- name: Setup Emscripten | ||
run: | | ||
git clone https://github.com/emscripten-core/emsdk.git ${EMSDK} | ||
cd ${EMSDK} | ||
./emsdk install latest | ||
./emsdk activate latest | ||
- uses: lukka/get-cmake@latest | ||
|
||
- name: Run CMake+vcpkg to build packages. | ||
uses: lukka/run-cmake@v10 | ||
with: | ||
configurePreset: 'emscripten-vcpkg' | ||
buildPreset: 'emscripten-vcpkg-debug' | ||
|
||
- name: Prepare for web deploy | ||
run: | | ||
mv cmake-build-presets/emscripten-vcpkg/Debug/openblack-imgui-prototype.html cmake-build-presets/emscripten-vcpkg/Debug/index.html | ||
cp main.cpp cmake-build-presets/emscripten-vcpkg/Debug | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./cmake-build-presets/emscripten-vcpkg/Debug | ||
publish_branch: gh-pages | ||
destination_dir: ${{ startsWith(github.event_name, 'pull_request') && format('pr/{0}', github.event.pull_request.number) || '' }} | ||
|
||
- name: Comment PR | ||
if: github.event_name == 'pull_request_target' | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const url = `https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.pull_request.number }}` | ||
const message = `🚀 PR was deployed in preview environment: [Open app](${url})` | ||
const comments = await github.rest.issues.listComments({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
const botComment = comments.data.find(comment => comment.user.login === 'github-actions[bot]'); | ||
if (botComment) { | ||
await github.rest.issues.updateComment({ | ||
comment_id: botComment.id, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: message, | ||
}); | ||
} else { | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: message, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Black & White style ImGui Theme prototype | ||
=== | ||
|
||
[Try it live](https://openblack.github.io/openblack-imgui-prototype) |