Publish #5
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: | |
version: | |
description: 'Version to pass to release.sh [vX.X.X]' | |
required: true | |
jobs: | |
version: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
# pull all the branches and tags | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
registry-url: https://registry.npmjs.org/ | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.16 | |
- name: Install git-chglog | |
run: | | |
curl https://i.jpillora.com/git-chglog/git-chglog! | sudo bash | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: npm install | |
- name: Setup git user | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: npm version | |
run: | | |
npm version ${{ github.event.inputs.version }} | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tags: true | |
branch: ${{ github.ref }} | |
- name: Create Release | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: npm publish | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} | |
token: ${{ secrets.ORG_NPM_TOKEN }} |