diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..15f071ce88 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build + +on: + workflow_call: + +jobs: + check_yarn_lock: + runs-on: ubuntu-latest + name: Check yarn.lock + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get changed files + id: changed-yarn-lock + uses: tj-actions/changed-files@v41 + with: + files: yarn.lock + outputs: + yarn_lock_changed: ${{ steps.changed-yarn-lock.outputs.any_changed }} + build: + runs-on: ubuntu-latest + name: Build JS packages + needs: check_yarn_lock + if: ${{ needs.check_yarn_lock.outputs.yarn_lock_changed }} + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + cache: "yarn" + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-modules + - name: Install dependencies + run: yarn install + - name: YARN build + run: yarn build diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 58adb877b9..8298f84872 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -10,58 +10,12 @@ on: pull_request: jobs: - check_yarn_lock: - runs-on: ubuntu-latest - name: Check yarn.lock - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Get changed files - id: changed-yarn-lock - uses: tj-actions/changed-files@v41 - with: - files: yarn.lock - outputs: - yarn_lock_changed: ${{ steps.changed-yarn-lock.outputs.any_changed }} - Build: - runs-on: ubuntu-latest - name: Build JS packages - needs: check_yarn_lock - if: ${{ needs.check_yarn_lock.outputs.yarn_lock_changed }} - permissions: - contents: write - pull-requests: read - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - persist-credentials: false - - name: Setup Node - uses: actions/setup-node@v4 - with: - cache: "yarn" - - name: Restore node_modules cache - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-modules - - name: Install dependencies - run: yarn install - - name: YARN build - run: yarn build - - uses: actions/upload-artifact@v4 - if: success() - with: - name: Javascripts - path: vendor/javascript + uses: ./.github/workflows/build.yml RSpec: - runs-on: ubuntu-latest needs: Build + runs-on: ubuntu-latest strategy: fail-fast: false matrix: diff --git a/.github/workflows/update_js.yml b/.github/workflows/update_js.yml index 01d53f4269..383794dd56 100644 --- a/.github/workflows/update_js.yml +++ b/.github/workflows/update_js.yml @@ -9,7 +9,22 @@ on: - 6.1-stable jobs: + Build: + uses: ./.github/workflows/build.yml + + Upload: + runs-on: ubuntu-latest + needs: Build + if: success('Build') + steps: + - uses: actions/checkout@v4 + - uses: actions/upload-artifact@v4 + with: + name: javascripts-${{ github.ref }} + path: vendor/javascript + update_js_packages: + needs: Upload runs-on: ubuntu-latest name: Update JS packages permissions: @@ -22,7 +37,7 @@ jobs: persist-credentials: false - uses: actions/download-artifact@v4 with: - name: Javascripts + name: javascripts-${{ github.ref }} path: vendor/javascript - name: Check git status id: git-status