Friends, developers, check this out.
I needed a way to run a basic confirmation that a project builds and passes linting while working with pull requests from other team members, so I threw these two GitHub workflows together. I hope they help you, too!
Confirm your Sage 10-based theme builds when you push or make a pull-request
# .github/workflows/sage10-build.yml
#
# This workflow presumes you're using Sage 10 and Trellis.
# Edit the paths below if your environment differs
name: Sage 10 Build
on: [push]
env:
THEME_SLUG: sage # Update this with your theme's directory name
NODE_VERSION: '16'
jobs:
yarn-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./site/web/app/themes/${{env.THEME_SLUG}}
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
cache: yarn
cache-dependency-path: ./site/web/app/themes/${{env.THEME_SLUG}}/yarn.lock
- run: yarn install
- run: yarn build
Confirm your Sage 10-based theme passes yarn lint
when you push or make a pull-request
# .github/workflows/sage10-lint.yml
#
# This workflow presumes you're using Sage 10 and Trellis.
# Edit the paths below if your environment differs
name: Sage 10 Lint
on: [push]
env:
THEME_SLUG: sage # Update this with your theme's directory name
NODE_VERSION: '16'
jobs:
yarn-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./site/web/app/themes/${{env.THEME_SLUG}}
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
cache: yarn
cache-dependency-path: ./site/web/app/themes/${{env.THEME_SLUG}}/yarn.lock
- run: yarn install
- run: yarn lint