Skip to content

Commit

Permalink
feat: npm publishing on release publish (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
CjHare authored Aug 31, 2022
1 parent 027c8fa commit 58a5191
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 5 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: NPM publish CD workflow

on:
release:
types: [published]

jobs:
NPM-Publish:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}

- uses: actions/cache@v3
name: Set up cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci

- name: Set publisher name
run: git config --global user.name "GitHub publish bot"

- name: Set publisher email
run: git config --global user.email "[email protected]"

- name: Bump the application version (package.json)
run: npm version ${{ github.event.release.tag_name }}

- name: Build application
run: npm run build

- name: Publish to NPM
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push version update (package.json)
run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
113 changes: 113 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Project config files
hardhat.config.ts
package-lock.json
renovate.json
slither.json
tsconfig.json
.eslintrc
.github/
.husky/
.lintstagedrc
.prettierignore
.prettierrc
.solhint.json
.solhintignore

# Test contracts and files
test/
contracts/test

# Hardhat
artifacts
cache

# TypeChain
typechain-types

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# JS file output directory
dist/

# IDE
.vscode

# Generated TS docs
doc/

# Eclipse project files
.project
.settings

# Jetbrains IDE
.idea

# Docker created bash file
.bash_history

# MacOS system files
.DS_Store

# OZ Cache (UUPS proxy deployment addresses)
.openzeppelin

# Yarn lock file (npm.lock covers this)
yarn.lock
yarn-error.log
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"name": "solidity-project-template",
"name": "@windranger-io/solidity-project-template",
"version": "0.0.3",
"description": "Everything you need for creating Solidity smart contract with TypeScript testing",
"private": true,
"license": "Apache-2.0",
"private": false,
"directories": {
"test": "test"
},
"publishConfig": {
"tag": "latest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/windranger-io/solidity-project-template"
},
"keywords": [],
"author": "",
"license": "Apache-2.0",
"keywords": [
"solidity",
"ethereum",
"developer-tools"
],
"scripts": {
"build": "hardhat compile",
"clean": "hardhat clean",
Expand Down

0 comments on commit 58a5191

Please sign in to comment.