Release Node.js SDK #87
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
--- | |
name: Release Node.js SDK | |
run-name: Release Node.js SDK | |
on: | |
push: | |
tags: | |
- "*.*.*" # version, e.g. 1.0.0 | |
defaults: | |
run: | |
shell: bash | |
working-directory: languages/node | |
jobs: | |
build-napi: | |
uses: ./.github/workflows/build-napi.yml | |
test-rust-crate: | |
uses: ./.github/workflows/rust-test.yml | |
secrets: | |
INFISICAL_UNIVERSAL_CLIENT_SECRET: ${{ secrets.INFISICAL_UNIVERSAL_CLIENT_SECRET }} | |
INFISICAL_UNIVERSAL_CLIENT_ID: ${{ secrets.INFISICAL_UNIVERSAL_CLIENT_ID }} | |
INFISICAL_PROJECT_ID: ${{ secrets.INFISICAL_PROJECT_ID }} | |
INFISICAL_SITE_URL: ${{ secrets.INFISICAL_SITE_URL }} | |
setup: | |
needs: | |
- test-rust-crate | |
name: Setup | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
npm: | |
name: Publish NPM | |
runs-on: ubuntu-22.04 | |
needs: | |
- setup | |
- build-napi | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Node | |
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | |
with: | |
node-version: 18 | |
cache: "yarn" | |
cache-dependency-path: yarn.lock | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: languages/node/artifacts | |
# Some artifacts have been downloaded as subdirectories of the artifacts directory | |
# Example: artifacts/binding.js/binding.js | |
# Example: artifacts/binding.d.ts/binding.d.ts | |
# We need to move the artifacts to the root of the artifacts directory | |
- name: Move artifacts to root of artifacts directory | |
run: mkdir artifacts2 && find ./artifacts/* -type f -exec mv -i {} ./artifacts2/ \; && rm -rf ./artifacts && mv ./artifacts2 ./artifacts | |
- name: Copy schema and binding converter | |
run: npm run copy:artifacts | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Set NPM version #get the version from the tag | |
run: npm version ${{ github.ref_name }} --allow-same-version --no-git-tag-version | |
- name: Run tsc | |
run: npm run tsc | |
- name: Setup NPM | |
run: | | |
echo 'registry="https://registry.npmjs.org/"' > ./.npmrc | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc | |
echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# - name: Pack NPM | |
# run: npm pack | |
# - name: Publish NPM | |
# run: npm publish --tarball=./sdk-${{github.ref_name}} | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Move artifacts | |
run: npm run artifacts | |
- name: List packages | |
run: ls -R ./npm | |
shell: bash | |
- name: List artifacts | |
run: ls -R ./artifacts | |
shell: bash | |
- name: Publish NPM | |
run: npm publish --access public --registry=https://registry.npmjs.org/ | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |