woocommerce/plugins/woocommerce-blocks/.github/workflows/check-modified-assets.yml

72 lines
2.6 KiB
YAML

name: Check Modified Assets
on:
pull_request:
jobs:
build-trunk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: trunk
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
- name: Use Node.js 16.13.2
uses: actions/setup-node@v1
with:
node-version: 16.13.2
- name: npm install and build
run: |
npm ci
npm run build:check-assets
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: assets-list
path: ./build/assets.json
compare-assets-with-trunk:
needs: [build-trunk]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
- name: Use Node.js 16.13.2
uses: actions/setup-node@v1
with:
node-version: 16.13.2
- name: npm install
run: |
npm ci
npm run build:check-assets
- name: Download assets (trunk)
uses: actions/download-artifact@v2
with:
name: assets-list
path: assets-list
- name: Compare Assets
uses: ./.github/compare-assets
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
compare: assets-list/assets.json