compile assets
This commit is contained in:
parent
c04a9f9861
commit
87ffc40fa4
|
|
@ -1,91 +1,17 @@
|
||||||
name: JS
|
name: Build JavaScript assets
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
env:
|
branches:
|
||||||
NODE_VERSION: 16
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prettier:
|
build:
|
||||||
name: Prettier
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- uses: actions/checkout@master
|
||||||
uses: actions/checkout@v2
|
- uses: flarum/action-build@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
cache: "npm"
|
|
||||||
cache-dependency-path: js/package-lock.json
|
|
||||||
|
|
||||||
- name: Install JS dependencies
|
|
||||||
run: npm ci
|
|
||||||
working-directory: ./js
|
|
||||||
|
|
||||||
- name: Check JS formatting
|
|
||||||
run: npm run format-check
|
|
||||||
working-directory: ./js
|
|
||||||
|
|
||||||
build-prod:
|
|
||||||
name: Build and commit
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [prettier]
|
|
||||||
|
|
||||||
# Only commit JS on push to master branch
|
|
||||||
# Remember to change in `build-test` job too
|
|
||||||
if: github.ref == 'refs/heads/main' && 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: "npm"
|
|
||||||
cache-dependency-path: js/package-lock.json
|
|
||||||
|
|
||||||
# Our action will install npm, cd into `./js`, run `npm run build` and
|
|
||||||
# `npm run build-typings`, 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: npm
|
|
||||||
# typings_script: build-typings
|
|
||||||
|
|
||||||
build-test:
|
|
||||||
name: Test build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [prettier]
|
|
||||||
|
|
||||||
# Inverse check of `build-prod`
|
|
||||||
# Remember to change in `build-prod` job too
|
|
||||||
if: github.ref != 'refs/heads/main' || 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: "npm"
|
|
||||||
cache-dependency-path: js/package-lock.json
|
|
||||||
|
|
||||||
# Our action will install npm, cd into `./js`, run `npm run build` and
|
|
||||||
# `npm run build-typings`, 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: npm
|
|
||||||
# typings_script: build-typings
|
|
||||||
do_not_commit: true
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue