Skip to content

Commit

Permalink
Merge pull request #14 from thesis/publish-to-npm
Browse files Browse the repository at this point in the history
Add a GH Actions workflow publishing npm package with contracts

Contracts stored in the `thesis/solidity-contracts` repository are used
as a dependency in other projects. Currently they are pulled from the
GitHub and referenced to by commit hash.
In this PR we add a GH Actions workflow that will publish npm
packages containing `*.sol` contracts and version them using `-pre.X`
suffix.
  • Loading branch information
nkuba authored Aug 17, 2022
2 parents 46e7084 + 179d6d8 commit 0aa49a2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: NPM

on:
push:
branches:
- main
paths:
- "contracts/**"
- "package.json"
- "yarn.lock"
workflow_dispatch:

jobs:
npm-compile-publish-contracts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: "14.x"
cache: "yarn"
registry-url: "https://registry.npmjs.org"

- name: Bump up package version
id: npm-version-bump
uses: keep-network/npm-version-bump@v2
with:
environment: pre
branch: ${{ github.ref }}
commit: ${{ github.sha }}

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public --tag pre
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{
"name": "@thesis/solidity-contracts",
"version": "0.0.1",
"name": "@thesis-co/solidity-contracts",
"version": "0.0.1-pre",
"license": "MIT",
"files": [
"contracts/**/*.sol"
],
"repository": {
"type": "git",
"url": "ssh://[email protected]/thesis/solidity-contracts"
},
"bugs": {
"url": "https://github.com/thesis/solidity-contracts/issues"
},
"homepage": "https://github.com/thesis/solidity-contracts",
"scripts": {
"build": "hardhat compile",
"format": "npm run lint && prettier --check .",
Expand Down

0 comments on commit 0aa49a2

Please sign in to comment.