Skip to content

Publish release candidate #9

Publish release candidate

Publish release candidate #9

name: Publish release candidate
on:
push:
tags:
# To bump, and push tagged commit:
# yarn version --prerelease && git push && git push --follow-tags || echo "FAILED!"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
workflow_dispatch:
jobs:
build_and_publish:
permissions:
id-token: write
contents: read
packages: write
env:
APP_NAME: ds
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get tag name
id: tag-name
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Get version without prefix
id: extract-version
run: |
# Extract version without prefix
version=$(echo "${{ steps.tag-name.outputs.tag }}" | sed 's/^v//' )
echo "version=$version" >> $GITHUB_ENV # Set the output variable using environment file
- name: Get dist tag without version suffix
id: extract-dist-tag
run: |
# Extract the dist tag without version suffix e.g. 0.0.0-alpha.1 = alpha, 0.0.0-beta = beta
dist_tag=$(echo "${{ steps.tag-name.outputs.tag }}" | sed 's/\.[0-9]\+$//' | cut -d'-' -f2)
echo "dist-tag=$dist_tag" >> $GITHUB_ENV # Set the output variable using environment file
- name: configure-node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
scope: 'telicent-oss'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
- name: Get node version
id: node
run: |
echo "version=$(node -v)" >> $GITHUB_OUTPUT
- name: Get node_modules cache
uses: actions/cache@v3.0.2
id: node_modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: yarn build
- run: npm publish --tag ${{ steps.extract-dist-tag.outputs.dist-tag }} --access public --provenance