1.3.2 #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: Bump and Publish | |
on: | |
release: | |
types: [released] | |
# refs/tags/x.x.x | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: 'Cache node Modules' | |
uses: actions/cache@v1 | |
with: | |
path: ~.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: yarn | |
- run: npm run test | |
bump-and-build: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- name: 'Cache node Modules' | |
uses: actions/cache@v1 | |
with: | |
path: ~.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: yarn | |
- run: npm --no-git-tag-version --allow-same-version version ${{ steps.get_version.outputs.VERSION }} | |
- run: npm run build | |
- run: npm pack | |
- name: 'Upload Build Artifatc ${{ steps.get_version.outputs.VERSION }}' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ steps.get_version.outputs.VERSION }}.tgz | |
path: piwikpro-react-piwik-pro-${{ steps.get_version.outputs.VERSION }}.tgz | |
publish-npm: | |
needs: bump-and-build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.get_version.outputs.VERSION }}.tgz | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm publish piwikpro-react-piwik-pro-${{ steps.get_version.outputs.VERSION }}.tgz | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |