Publish to NPM #3
Workflow file for this run
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
--- | |
# yamllint disable rule:line-length | |
name: "Publish to NPM" | |
on: # yamllint disable-line rule:truthy | |
release: | |
types: | |
- "published" | |
jobs: | |
publish: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: bahmutov/npm-install@v1 | |
- run: yarn test | |
- uses: battila7/get-version-action@v2 | |
# Set the version in package.json to match the tag | |
- run: "npm version ${{ steps.get_version.outputs.version-without-v }}" | |
- uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
tag: ${{ steps.get_version.outputs.version }} | |
access: public | |
# NOTE: this publishes an alternate version that doesn't depend on protobuf-ts/runtime | |
publish-js-client: | |
name: Publish JS client to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: "yarn" | |
# Install deps in base package and build into js-dist | |
- uses: bahmutov/npm-install@v1 | |
- name: Run build | |
run: yarn build-js-client | |
- uses: bahmutov/npm-install@v1 | |
with: | |
working-directory: ./js-dist | |
- uses: battila7/get-version-action@v2 | |
# Set the version in package.json to match the tag | |
- run: "npm version ${{ steps.get_version.outputs.version-without-v }}" | |
working-directory: ./js-dist | |
- uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
tag: ${{ steps.get_version.outputs.version }} | |
# Point at the js-dist directory as the working directory | |
package: js-dist | |
access: public |