feat: add static ESM build configuration and expose access to sass op… #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: build-release-${{ github.ref }} | |
jobs: | |
wf-config: | |
name: Workflow Configuration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Prepare Repository | |
run: git fetch --unshallow --tags | |
- name: Cache Dependencies | |
id: cache | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install | |
id: install | |
run: npm ci | |
## Determine if this is a release build or not, which will affect which dependent jobs run below | |
- name: Detect Release Status | |
id: detect-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.FORGE_NPM_TOKEN }} | |
run: | | |
## We use `auto version` to calculate whether this is a release build or not | |
VERSION_RESULT=$(npx auto version) | |
echo "Version calculation result: ${VERSION_RESULT}" | |
if [[ "${VERSION_RESULT}" =~ ^(major|minor|patch|release)$ ]]; then | |
echo "Release: true" | |
echo "release=true" >> $GITHUB_OUTPUT | |
else | |
echo "Release: false" | |
echo "release=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Check File Changes | |
uses: dorny/paths-filter@v3 | |
id: file-filter | |
with: | |
filters: | | |
build: | |
- '.github/workflows/**' | |
- '.eslintrc.json' | |
- '.autorc' | |
- 'gulpfile.ts' | |
- 'tsconfig.json' | |
- 'bin/**' | |
- 'config/**' | |
- 'src/**' | |
- 'templates/**' | |
outputs: | |
is-release: ${{ steps.detect-release.outputs.release }} | |
build-files-changed: ${{ steps.file-filter.outputs.build == 'true' }} | |
build: | |
name: Build and Test | |
needs: wf-config | |
uses: tyler-technologies-oss/forge-automation-shared/.github/workflows/[email protected] | |
if: ${{ needs.wf-config.outputs.is-release == 'false' && (needs.wf-config.outputs.build-files-changed == 'true' || needs.wf-config.outputs.test-files-changed == 'true') }} | |
with: | |
BUILD_ENABLED: ${{ needs.wf-config.outputs.build-files-changed == 'true' }} | |
secrets: | |
NPM_TOKEN: ${{ secrets.FORGE_NPM_TOKEN }} | |
build-and-release: | |
name: Build and Release | |
needs: wf-config | |
uses: tyler-technologies-oss/forge-automation-shared/.github/workflows/[email protected] | |
if: ${{ needs.wf-config.outputs.is-release == 'true' }} | |
with: | |
PRODUCTION_RELEASE: true | |
secrets: | |
GITHUB_APP_ID: ${{ secrets.FORGE_AUTOBOT_ID }} | |
GITHUB_APP_KEY: ${{ secrets.FORGE_AUTOBOT_SECRET }} | |
NPM_TOKEN: ${{ secrets.FORGE_NPM_TOKEN }} |