feat: add <ForgeButtonArea>
wrapper (#10)
#11
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
## We only run this workflow on pushes to the main branch. This workflow will | |
## first determine if a release is to be published, and if so, build and publish. | |
## Otherwise, if not a release, we just perform CI build validation. | |
name: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/**/*' | |
- '.eslintrc.json' | |
- 'package.json' | |
- 'auto.config.ts' | |
- 'gulpfile.js' | |
- 'tsconfig.json' | |
- 'src/projects/**/*' | |
concurrency: build-release-${{ github.ref }} | |
jobs: | |
## Gather configuration required by other jobs | |
wf-config: | |
name: Workflow Configuration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Prepare Repository | |
# Fetch full git history and tags | |
run: git fetch --unshallow --tags | |
- name: Cache Dependencies | |
id: cache | |
uses: actions/cache@v2 | |
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@v2 | |
with: | |
node-version: "14" | |
- 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) | |
if [[ "${VERSION_RESULT}" =~ ^(major|minor|patch|release)$ ]]; then | |
echo "::set-output name=release::true" | |
else | |
echo "::set-output name=release::false" | |
fi | |
## Detect if any specific files we care about have changed to help us know if we need to execute a CI build or Storybook deployment at all or not | |
- name: Check File Changes | |
uses: dorny/paths-filter@v2 | |
id: file-filter | |
with: | |
filters: | | |
build: | |
- '.github/workflows/**' | |
- '.eslintrc.json' | |
- 'auto.config.ts' | |
- 'package.json' | |
- 'gulpfile.js' | |
- 'tsconfig.json' | |
- 'src/projects/**' | |
outputs: | |
is-release: ${{ steps.detect-release.outputs.release }} | |
build-files-changed: ${{ steps.file-filter.outputs.build == 'true' }} | |
# This job will run on non-release builds for general CI validation only if files are changed that need to be built | |
build: | |
name: Build | |
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' }} | |
secrets: | |
NPM_TOKEN: ${{ secrets.FORGE_NPM_TOKEN }} | |
## This job will run on release builds when publishing a new version | |
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 }} |