Skip to content

Commit

Permalink
Fix(CI): Build JS packages w/o artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Feb 19, 2024
1 parent 0886adb commit 88cd07c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 52 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 }}
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
50 changes: 2 additions & 48 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ on:
- 6.1-stable

jobs:
Build:
uses: ./.github/workflows/build.yml

update_js_packages:
needs: Build
runs-on: ubuntu-latest
name: Update JS packages
permissions:
Expand All @@ -20,10 +24,6 @@ jobs:
with:
ref: ${{ github.ref }}
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: Javascripts
path: vendor/javascript
- name: Check git status
id: git-status
run: git diff --quiet || echo "changed=true" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 88cd07c

Please sign in to comment.