Robin Malfait c2854dae71
Calculate tag for releases based on package.json version (#9572)
* calculate tag for the release

This is based on the name we use in the version e.g.: `3.2.0-beta.2`. If
no name can be found in the version, we will default to `latest`

* ignore node_modules caching for now
2022-10-16 16:20:21 +02:00

57 lines
1.2 KiB
YAML

name: Release
on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
# cache: 'npm'
#
# - name: Use cached node_modules
# id: cache
# uses: actions/cache@v3
# with:
# path: node_modules
# key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}
# restore-keys: |
# nodeModules-
- name: Install dependencies
# if: steps.cache.outputs.cache-hit != 'true'
run: npm install
env:
CI: true
- name: Test
run: npm test
env:
CI: true
- name: Calculate tag
run: |
echo "tag_name=$(npm run calculate-tag-name --silent)" >> $GITHUB_ENV
- name: Publish
run: npm publish --tag ${{ env.tag_name }}
env:
CI: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}