52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
|
name: NPM Release
|
||
|
|
||
|
# Runs when a new release is published on GitHub.
|
||
|
# Creates a corresponding NPM release and publishes it.
|
||
|
#
|
||
|
# Can also be run manually for debugging purposes.
|
||
|
on:
|
||
|
release:
|
||
|
types: [published]
|
||
|
# For manual debugging:
|
||
|
workflow_dispatch:
|
||
|
inputs:
|
||
|
ref:
|
||
|
description: "The tag to release to NPM."
|
||
|
required: True
|
||
|
|
||
|
jobs:
|
||
|
publish_npm:
|
||
|
name: Publish to NPM
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Compute ref
|
||
|
id: ref
|
||
|
# We could be building from a workflow dispatch (manual run), or a
|
||
|
# release event. Subsequent steps can refer to $TARGET_REF to
|
||
|
# determine the correct ref in all cases.
|
||
|
run: |
|
||
|
echo "TARGET_REF=${{ github.event.inputs.ref || github.event.release.tag_name }}" >> $GITHUB_ENV
|
||
|
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
path: src
|
||
|
ref: ${{ env.TARGET_REF }}
|
||
|
|
||
|
- name: Setup NodeJS
|
||
|
uses: actions/setup-node@v1
|
||
|
with:
|
||
|
node-version: 10
|
||
|
|
||
|
- name: Set package version
|
||
|
run: |
|
||
|
cd src/npm
|
||
|
npm version ${{ env.TARGET_REF }}
|
||
|
|
||
|
- name: Publish NPM package
|
||
|
uses: JS-DevTools/npm-publish@v1
|
||
|
with:
|
||
|
token: ${{ secrets.NPM_CI_TOKEN }}
|
||
|
package: src/npm/package.json
|
||
|
check-version: false
|