Skip to content

v0.1.1

v0.1.1 #1

Workflow file for this run

name: Release
on:
push:
tags: ['*']
jobs:
release:
name: Release [Node.js ${{ matrix.node-version }}]
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x]
env:
CI: true
steps:
- name: Checkout
uses: actions/checkout@v4
##########################################################################
# Build
##########################################################################
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
corepack enable
yarn install
- name: Lint
run: yarn lint
- name: Build
run: yarn build
- name: Test
run: yarn test
##########################################################################
# Publish
##########################################################################
- name: Check tag format
id: check-tag-format
uses: nowsprinting/check-version-format-action@v4
- name: Exit on invalid tag format
if: '!steps.check-tag-format.outputs.is_valid'
run: echo "Tag must follow SemVer convention. Aborting." && exit 1
- name: Get release type
id: get-release-type
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const regex = /(alpha|beta)/
const refName = context.ref.replace('refs/tags/', '')
console.log(`Ref tag: ${refName}`)
const releaseTypeMatch = refName.match(regex)
if (!releaseTypeMatch) {
releaseType = 'latest'
} else {
releaseType = releaseTypeMatch[0]
}
console.log(`Release type: ${releaseType}`)
return releaseType
- name: Set version from tag to environment variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Ignore changes to .yarnrc.yml
run: git update-index --assume-unchanged .yarnrc.yml
- name: Configure yarn to publish packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_CARTODB_AUTH_TOKEN }}
run: |
# Yarn config
yarn config set npmPublishRegistry "https://registry.npmjs.org/"
yarn config set npmAuthToken "${NODE_AUTH_TOKEN}"
# Create .npmrc file
echo "@carto:registry=https://registry.npmjs.org/" > .npmrc
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
# Check configuration
npm config get registry
npm view @carto/create-common versions
- name: Publish package with Lerna
env:
RELEASE_TYPE: ${{ steps.get-release-type.outputs.result }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_CARTODB_AUTH_TOKEN }}
run: |
set -x
yarn lerna publish from-git --yes --dist-tag ${RELEASE_TYPE} --loglevel verbose