From e94701d39c7357327dfb8f6a431474cf1c02be47 Mon Sep 17 00:00:00 2001 From: iPurpl3x Date: Tue, 21 Dec 2021 18:34:33 +0100 Subject: [PATCH] fixed build workflow --- .github/workflows/build.yml | 16 --------- .github/workflows/js.yml | 66 +++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/js.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 805b3d4..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Build JavaScript assets - -on: - push: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@master - - uses: flarum/action-build@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml new file mode 100644 index 0000000..29a7a2e --- /dev/null +++ b/.github/workflows/js.yml @@ -0,0 +1,66 @@ +name: JS + +on: [workflow_dispatch, push, pull_request] + +env: + NODE_VERSION: 16 + +jobs: + build-prod: + name: Build and commit + runs-on: ubuntu-latest + + # Only commit JS on push to master branch + # Remember to change in `build-test` job too + if: github.ref == 'refs/heads/master' && github.event_name == 'push' + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'yarn' + cache-dependency-path: js/yarn.lock + + # Our action will install node, npm and yarn, cd into `./js`, run `yarn run build` (and + # `yarn run build-typings` if desired), then commit and upload any changes + - name: Build production JS + uses: flarum/action-build@2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + build_script: build + package_manager: yarn + # typings_script: build-typings + + build-test: + name: Test build + runs-on: ubuntu-latest + + # Inverse check of `build-prod` + # Remember to change in `build-prod` job too + if: github.ref != 'refs/heads/master' || github.event_name != 'push' + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'yarn' + cache-dependency-path: js/yarn.lock + + # Our action will install node, npm and yarn, cd into `./js`, run `yarn run build` (and + # `yarn run build-typings` if desired). It will NOT commit and upload. + - name: Build production JS + uses: flarum/action-build@2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + build_script: build + package_manager: yarn + # typings_script: build-typings + do_not_commit: true