Publish #27
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: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: "Version of this release" | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/[email protected] | |
- name: Cache 📦 | |
uses: actions/cache@v1 | |
with: | |
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Setup Node Environment ⬢ | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Tag release | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ github.event.inputs.release_version }} | |
message: "Release ${{ github.event.inputs.release_version }}" | |
- name: Update version in package.json | |
id: version-bump | |
uses: jaywcjlove/[email protected] | |
with: | |
version: ${{ github.event.inputs.release_version }} | |
- name: Install 🔧 | |
run: npm install | |
- name: Conditional | |
id: cond | |
uses: haya14busa/action-cond@v1 | |
with: | |
cond: ${{ contains(github.event.inputs.release_version, '-') }} | |
if_true: "next" | |
if_false: "latest" | |
- name: Publish 📦 | |
id: publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
tag: ${{ steps.cond.outputs.value }} | |
access: public | |
check-version: true | |
- name: Release | |
if: steps.publish.outputs.type != 'none' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.publish.outputs.version }} | |
generateReleaseNotes: true | |
prerelease: ${{ contains(steps.publish.outputs.type, 'pre') }} | |
token: ${{ secrets.GITHUB_TOKEN }} |