Merge pull request #119 from alephium/improvements #24
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: Publish | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' | |
jobs: | |
get_dist_tag: | |
runs-on: ubuntu-latest | |
outputs: | |
DIST_TAG: ${{ steps.get_tag.outputs.DIST_TAG }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get the tag name | |
id: get_tag | |
run: | | |
tag=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-) | |
dist_tag=$([[ $tag =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo latest || echo "") | |
dist_tag=$([[ $tag =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ ]] && echo rc || echo $dist_tag) | |
[ -z "$dist_tag" ] && echo "Distribution tag is not set to latest nor to rc" && exit 1 | |
echo "DIST_TAG=$dist_tag" >> $GITHUB_OUTPUT | |
shell: bash | |
publish: | |
needs: get_dist_tag | |
if: needs.get_dist_tag.outputs.DIST_TAG | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish to npm | |
run: | | |
npm ci | |
npm publish --access public --tag ${{ needs.get_dist_tag.outputs.DIST_TAG }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |