Переглянути джерело

Develop branch prebuilt frontend bundle (#1576) (#1577)

* add prebuild github actions

* fix after testing

* add develop on run

* per fred

* per Fred

* per Fred
Dinh Long Nguyen 9 місяців тому
батько
коміт
ae0d1bba6b
1 змінених файлів з 83 додано та 0 видалено
  1. 83 0
      .github/workflows/prebuild.yml

+ 83 - 0
.github/workflows/prebuild.yml

@@ -0,0 +1,83 @@
+name: Generate prebuild for develop branch
+
+on:
+  push:
+    branches: [develop]
+  workflow_dispatch:
+
+permissions:
+  contents: write
+
+env:
+  NODE_OPTIONS: --max-old-space-size=4096
+
+jobs:
+  reset-prebuild:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Reset prebuild branch to develop
+        uses: nicksnell/action-reset-repo@master
+        with:
+          base_branch: develop
+          reset_branch: prebuild
+
+  prebuild:
+    needs: reset-prebuild
+    timeout-minutes: 20
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          ref: develop
+
+      - uses: actions/setup-python@v5
+        with:
+          python-version: "3.11"
+
+      - name: Hash frontend source code
+        id: hash-frontend
+        run: |
+          python tools/frontend/hash_source.py
+          echo "HASH=$(cat hash.txt)" >> $GITHUB_OUTPUT
+          rm hash.txt
+        shell: bash
+
+      - name: Restore cached frontend build
+        id: cache-fe-build
+        uses: actions/cache@v4
+        with:
+          path: |
+            taipy/gui/webapp
+            taipy/gui_core/lib
+          key: frontend-build-${{ runner.os }}-${{ steps.hash-frontend.outputs.HASH }}
+
+      - name: Setup node
+        if: steps.cache-fe-build.outputs.cache-hit != 'true'
+        uses: actions/setup-node@v4
+        with:
+          node-version: "20"
+          cache: "npm"
+          cache-dependency-path: "**/package-lock.json"
+
+      - name: Frontend Bundle Build
+        if: steps.cache-fe-build.outputs.cache-hit != 'true'
+        run: python tools/frontend/bundle_build.py
+
+      - name: Reset npm dependencies
+        if: steps.cache-fe-build.outputs.cache-hit != 'true'
+        run: |
+          git checkout -- frontend/taipy/package.json
+          git checkout -- frontend/taipy/package-lock.json
+          git checkout -- frontend/taipy-gui/package-lock.json
+
+      - name: Add frontend build force to bypass gitignore
+        run: |
+          git add -f taipy/gui/webapp
+          git add -f taipy/gui_core/lib
+
+      - name: Commit prebuild changes
+        uses: stefanzweifel/git-auto-commit-action@v5
+        with:
+          branch: prebuild
+          add_options: "-u"
+          push_options: "--force"