Skip to content

esbuild Compilation & npm Publish Workflow #25

esbuild Compilation & npm Publish Workflow

esbuild Compilation & npm Publish Workflow #25

name: esbuild Compilation & npm Publish Workflow
on:
workflow_run:
workflows:
- create-github-release
types:
- completed
workflow_dispatch:
inputs:
branch:
description: 'Set the branch to use for automation tests'
type: string
required: false
default: 'main'
nodeVersion:
description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers
type: string
default: lts/*
required: false
jobs:
build:
runs-on: ubuntu-latest
if: ${{ inputs.branch || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodeVersion }}
registry-url: 'https://registry.npmjs.org'
cache: yarn
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
- name: Install esbuild Dependencies
run: |
yarn add -D esbuild@^0.19.5 esbuild-plugin-pino@^2.1.0 npm-dts@^1.3.12 esbuild-plugin-tsc@^0.4.0
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
- name: Update for Bundling
run: |
node scripts/updateForBundling.js
- name: Generate Bundle
run: |
yarn build
node scripts/build.js
- name: Post Bundling Update
run: |
node scripts/postBundlingUpdate.js
- name: Publish a Package
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}