Skip to content

Update GH upload-artifact action to v4 to fix build #2492

Update GH upload-artifact action to v4 to fix build

Update GH upload-artifact action to v4 to fix build #2492

# This workflow will do a clean install of your theme's dependencies and attempt to bundle the theme with Stencil CLI.
# If the theme fails to bundle, you can review the error logs to find out why.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Theme Bundling Test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [18.x, 20.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Normalize line endings (Windows only)
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git rm --cached -r .
git reset --hard
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node }}
- name: Read package.json
uses: zvonimirsun/read-package-version-actions@v2
id: package-version
- name: Get short SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: npm cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ matrix.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-${{ matrix.node }}
- name: Install Stencil CLI Dependency
run: npm install -g @bigcommerce/stencil-cli
- name: Install Theme Dependencies
run: npm ci
- name: Grunt Check
run: npx grunt check
- name: Validate theme successfully bundles
run: npx stencil bundle --name ${{ matrix.os }}-node-${{ matrix.node }}-v${{ steps.package-version.outputs.version }}-${{ steps.vars.outputs.sha_short }}-bundle
- name: Upload bundled theme
uses: actions/upload-artifact@v4
with:
name: Bundled-Theme-${{ matrix.os }}-node-${{ matrix.node }}-v${{ steps.package-version.outputs.version }}-${{ steps.vars.outputs.sha_short }}
path: ${{ matrix.os }}-node-${{ matrix.node }}-v${{ steps.package-version.outputs.version }}-${{ steps.vars.outputs.sha_short }}-bundle.zip
- name: Rename bundle analysis report
run: mv assets/dist/report.html assets/dist/${{ matrix.os }}-node-${{ matrix.node }}-v${{ steps.package-version.outputs.version }}-${{ steps.vars.outputs.sha_short }}-report.html
- name: Upload bundle analysis
uses: actions/upload-artifact@v4
with:
name: Webpack-Analysis-${{ matrix.os }}-node-${{ matrix.node }}-v${{ steps.package-version.outputs.version }}-${{ steps.vars.outputs.sha_short }}
path: assets/dist/${{ matrix.os }}-node-${{ matrix.node }}-v${{ steps.package-version.outputs.version }}-${{ steps.vars.outputs.sha_short }}-report.html