From a75ea76cc823d70ab8b8acf002c7e9d18b0e2dc9 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sat, 29 Jul 2023 16:35:08 -0700 Subject: [PATCH] chore: only run commit web project build on develop --- .github/workflows/javascript-format-build.yml | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/javascript-format-build.yml b/.github/workflows/javascript-format-build.yml index 42b239656..17983b1c0 100644 --- a/.github/workflows/javascript-format-build.yml +++ b/.github/workflows/javascript-format-build.yml @@ -11,7 +11,7 @@ on: jobs: formatting: - name: Javascript code formatting + name: Code formatting runs-on: ubuntu-latest defaults: run: @@ -44,6 +44,18 @@ jobs: - '**.css' - '**.md' + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-bundle-web-app + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install Dependencies run: npm install @@ -85,6 +97,18 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} fetch-depth: 0 + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-bundle-web-app + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install Dependencies run: npm install @@ -95,6 +119,7 @@ jobs: # and bundle step. This both will verify that the build is successful as # well as commiting the updated static files into the repository for use. web-bundle: + name: Build and bundle web project runs-on: ubuntu-latest if: github.repository == 'owncast/owncast' @@ -120,8 +145,11 @@ jobs: uses: actions/checkout@v3 - run: build/web/bundleWeb.sh + # Only commit built web project files on develop. - name: Commit changes + if: ${{ github.ref == 'refs/heads/develop' && env.GH_CR_PAT != null }} uses: EndBug/add-and-commit@v9 + with: pull: --rebase --autostash message: 'Bundle embedded web app'