Release #21
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 | |
on: [workflow_call, workflow_dispatch] | |
env: | |
NODE_VERSION: 20 | |
CI: true | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Read package version | |
id: version | |
run: echo "PKG_VERSION=v$(npm pkg get version | xargs)" >> $GITHUB_OUTPUT | |
- name: Set up Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Assign dist tag | |
id: dist-tag | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const version = '${{ steps.version.outputs.PKG_VERSION }}' | |
console.log(`version: ${version}`) | |
if (version.match(/^v\d+\.\d+\.\d+$/)) { | |
distTag = 'latest' | |
} else if (version.match(/^v\d+\.\d+\.\d+/)) { | |
distTag = 'alpha' | |
} else { | |
core.setFailed('Version must follow SemVer convention. Aborting.'); | |
} | |
console.log(`npm dist tag: ${distTag}`) | |
return distTag | |
- name: Install | |
run: | | |
corepack enable | |
yarn install | |
- name: Build | |
run: | | |
yarn lint | |
yarn build | |
yarn test | |
- name: Configure yarn to publish packages | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_CARTODB_AUTH_TOKEN }} | |
run: | | |
yarn config set npmPublishRegistry "https://registry.npmjs.org/" | |
yarn config set npmAuthToken "${NPM_AUTH_TOKEN}" | |
- name: Publish | |
env: | |
DIST_TAG: ${{ steps.dist-tag.outputs.result }} | |
run: yarn npm publish --tag ${DIST_TAG} |