Release #54
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: set version for this release | |
default: "minor" | |
type: choice | |
options: | |
- "major" | |
- "minor" | |
- "patch" | |
- "prerelease" | |
env: | |
PACKAGE_NAME: "@ledgerhq/exchange-sdk" | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9.4.0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16 | |
registry-url: 'https://registry.npmjs.org' | |
cache: pnpm | |
- name: Setup jq | |
run: sudo apt-get install jq | |
- name: Setup temp github user | |
run: | | |
git config user.email "action@github.com" | |
git config user.name "Github Bot" | |
- name: Install Dependencies | |
run: pnpm --frozen-lockfile --filter exchange-sdk install | |
- name: Set current npm registry version in package.json | |
working-directory: ./lib | |
run: jq --arg v "$(pnpm show $PACKAGE_NAME version)" '.version=$v' package.json > tmp && mv tmp package.json | |
- name: Create new version | |
working-directory: ./lib | |
run: pnpm version ${{ inputs.version }} --no-git-tag-version --workspaces-update false | |
- name: Build exchange-sdk | |
run: pnpm --filter exchange-sdk build | |
- name: Publish package to npm registry | |
run: pnpm publish --filter exchange-sdk --access public --no-git-checks | |
env: | |
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
- name: Revert git changes and push version tag | |
working-directory: ./lib | |
run: | | |
VERSION=$(jq ".version" ./package.json) | |
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA") | |
git checkout $GIT_HASH -- ./package.json | |
git tag $VERSION | |
git push --tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |