Merge pull request #436 from blocto/release/1014 #35
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
name: Publish to npm | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Publish to npm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Dependencies | |
run: yarn | |
- name: Attempting to publish packages to npm | |
uses: changesets/action@v1 | |
with: | |
publish: yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Set version from publishedPackages | |
id: setVersion | |
if: steps.changesets.outputs.published == 'true' | |
env: | |
PACKAGE_VERSION: ${{ steps.changesets.outputs.publishedPackages }} | |
run: echo "PACKAGE_VERSION=$(echo $PACKAGE_VERSION | jq -r '.[0].version')" >> $GITHUB_OUTPUT | |
- name: Trigger example repo github action | |
if: steps.changesets.outputs.published == 'true' | |
run: | | |
curl -H "Authorization: Bearer ${{ secrets.DEV_GITHUB_TOKEN }}" \ | |
-H 'Accept: application/vnd.github.everest-preview+json' \ | |
"https://api.github.com/repos/blocto/blocto-sdk-examples/dispatches" \ | |
-d '{"event_type": "update-package", "client_payload": {"version": "${{ steps.setVersion.outputs.PACKAGE_VERSION }}" }}' |