-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce publish-package reusable workflow
Publish a node package to npm: - Beta of stable. - Install with `yarn install` or not.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
################################################### | ||
# A reusable workflow for publishing a Node package. | ||
# | ||
# inputs: | ||
# beta: Run the workflow for beta releases. | ||
# nodeVersion: The version of Node to install. | ||
# withInstall: Run `yarn install` before publishing. | ||
# secrets: | ||
# NPM_TOKEN: From "Access Tokens" settings in NPM profile (or CRM stored one). | ||
# | ||
################################################### | ||
name: Publish Node Package | ||
|
||
env: | ||
VERSION: 0.0.1 | ||
TZ: 'America/New_York' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
beta: | ||
description: Run the workflow for beta releases. | ||
required: true | ||
type: boolean | ||
nodeVersion: | ||
required: true | ||
type: string | ||
withInstall: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
publish: | ||
name: Publish on npm.js | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node and PHP | ||
uses: lipemat/public-actions/setup-dependencies@version/1 | ||
env: | ||
NODE_VERSION: ${{ inputs.node_version }} | ||
PHP_VERSION: latest | ||
|
||
- if: ${{ inputs.withInstall }} | ||
name: Install node modules | ||
shell: bash | ||
run: yarn install | ||
|
||
- if: ${{ inputs.beta == false}} | ||
name: Publish to NPM | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
|
||
- if: ${{ inputs.beta == true}} | ||
name: Publish Beta to NPM | ||
run: npm publish --tag beta | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |