Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: publish to npm #22

Merged
merged 12 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "21.1.0"
node-version: "22.0.0"

- name: NPM install
run: npm install
- name: Install Dependencies
run: yarn

- name: Run Prettier
run: npm run prettier
run: yarn prettier

- name: Run Tests
run: |
npm run test | tee test_output.txt
yarn test | tee test_output.txt

- name: Find Gas Report
id: find_report
Expand All @@ -44,4 +44,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: gas_report.csv
path: gas_report.csv
path: gas_report.csv
41 changes: 41 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish to npm

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: yarn

- name: Build
run: yarn build

- name: Determine NPM Tag
id: determine-npm-tag
run: |
VERSION_TAG="${{ github.event.inputs.version }}"
if [[ $VERSION_TAG == *"-"* ]]; then
echo "NPM_TAG=${VERSION_TAG#*-}" >> $GITHUB_ENV
else
echo "NPM_TAG=latest" >> $GITHUB_ENV
fi

- name: Publish to NPM
run: |
yarn publish --new-version ${{ github.event.inputs.version }} --tag ${{ env.NPM_TAG }} --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading