Skip to content

Instantly share code, notes, and snippets.

@lanwen
Created April 20, 2020 09:19
Show Gist options
  • Save lanwen/d9cf959ed9dd71a02bd50e09abdc04ec to your computer and use it in GitHub Desktop.
Save lanwen/d9cf959ed9dd71a02bd50e09abdc04ec to your computer and use it in GitHub Desktop.
name: Node.js Package
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://npm.pkg.github.com'
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
working-directory: cdk
- run: npm run build
working-directory: cdk
- run: npm version ${GITHUB_REF#refs/tags/} --no-git-tag-version
working-directory: cdk
- run: npm publish
working-directory: cdk
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment