Merge pull request #140 from dmeybohm/move-files #256
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: "web" | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mymindstorm/setup-emsdk@v11 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Verify | |
run: emcc -v | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: > | |
emcmake cmake -B ${{ github.workspace }}/build | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo | |
-DWISDOM_CHESS_FAST_TESTS=Off | |
-DWISDOM_CHESS_SLOW_TESTS=Off | |
-S ${{ github.workspace }} | |
- name: Build Library | |
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
run: cmake --build ${{ github.workspace }}/build --config Release -j 4 | |
- name: Install Front-end Dependencies | |
working-directory: ${{ github.workspace }}/src/wisdom-chess/ui/react | |
run: npm ci | |
- name: Build Front-end | |
working-directory: ${{ github.workspace }}/src/wisdom-chess/ui/react | |
run: npm run build | |
- name: Install Netlify CLI | |
working-directory: ${{ github.workspace }}/src/wisdom-chess/ui/react | |
run: npm install -g netlify-cli | |
- name: Deploy Preview | |
if: github.event.pull_request.merged != true && github.actor != 'dependabot[bot]' | |
working-directory: ${{ github.workspace }}/src/wisdom-chess/ui/react | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
run: netlify deploy --dir dist | |
- name: Deploy Production | |
if: github.event.pull_request.merged == true && github.base_ref == 'main' | |
working-directory: ${{ github.workspace }}/src/wisdom-chess/ui/react | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
run: netlify deploy --dir dist --prod | |