Merge pull request #412 from Tonomy-Foundation/testnet #337
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: Tonomy SDK publish | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- development | |
- testnet | |
- master | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install jq | |
run: sudo apt install jq -y | |
- name: 🏗 Setup repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{secrets.MY_GITHUB_PERSONAL_ACCESS_TOKEN}} | |
- name: Enable Corepack before setting up Node | |
run: corepack enable | |
- name: 📦 Install | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.3.0 | |
registry-url: https://registry.npmjs.org/ | |
- name: 🚀 Build and publish SDK | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.3.0 | |
- name: Check branch name | |
run: echo ${GITHUB_REF#refs/*/} | |
- run: | | |
if [[ ${GITHUB_REF#refs/*/} == "development" ]]; then | |
echo "Variable BRANCH_NAME is set to 'development'" | |
jq --arg tag "development" '.publishConfig.tag = $tag' package.json > package.tmp.json && mv package.tmp.json package.json | |
fi | |
if [[ ${GITHUB_REF#refs/*/} == "testnet" ]]; then | |
echo "Variable BRANCH_NAME is set to 'testnet'" | |
jq --arg tag "rc" '.publishConfig.tag = $tag' package.json > package.tmp.json && mv package.tmp.json package.json | |
fi | |
- run: yarn install --immutable | |
- run: yarn run build | |
- run: yarn run release | |
env: | |
GITHUB_TOKEN: ${{secrets.MY_GITHUB_PERSONAL_ACCESS_TOKEN}} | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |