build: Improve deploy wiki workflow #15
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
name: Deploy web app | |
on: | |
workflow_dispatch: | |
push: | |
branches: main | |
jobs: | |
deploy-web-app: | |
name: Deploy web app | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Build the web app | |
run: ./gradlew sample:wasmJsBrowserDistribution | |
- name: Check out the gh-pages branch | |
run: | | |
git fetch origin gh-pages:gh-pages | |
git checkout gh-pages | |
- name: Remove old app directory | |
run: | | |
rm -rf app/* | |
- name: Create app directory | |
run: mkdir -p app | |
- name: Move build artifacts to app directory | |
run: | | |
mv sample/build/dist/wasmJs/productionExecutable/* app/ | |
- name: Commit and push changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
commit_message: "Update web app" | |
branch: gh-pages | |
file_pattern: app/* |