Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/github-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Version tags only

name: GitHub Publish

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+-[a-z]+

env:
NODE_VERSION: 18

jobs:
npmPublish:
name: Publish to npm
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v3
with:
path: |
~/.npm
node_modules
key: npm-v${{ env.NODE_VERSION }}-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}

- name: Install Node.js and npm
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://npm.pkg.github.com

- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm ci

- name: Build local package
run: npm run build

- name: Publish new version
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
# as it appears actions/setup-node sets own value
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish

- name: Create and publish a release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
prerelease: false
generate_release_notes: true
Loading