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 4ea5c7d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 49 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
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
17 changes: 16 additions & 1 deletion .github/workflows/update_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 4ea5c7d

Please sign in to comment.