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

add npm publishing to script #3

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
44 changes: 43 additions & 1 deletion .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:

jobs:
create-release:
runs-on: ubuntu-latest
runs-on:
group: npm-deploy
environment:
name: release
steps:
Expand Down Expand Up @@ -37,6 +38,26 @@ jobs:
env:
LATEST_TAG: ${{ steps.get_latest_tag.outputs.LATEST_TAG }}

- name: Update package.json version
run: |
new_version=${{ steps.increment_version.outputs.NEW_VERSION }}
jq --arg new_version "$new_version" '.version = $new_version' package.json > package.json.tmp && mv package.json.tmp package.json
env:
NEW_VERSION: ${{ steps.increment_version.outputs.NEW_VERSION }}

- name: Setup SSH
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}

- name: Commit updated package.json
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add package.json
git commit -m "Release ${{ steps.increment_version.outputs.NEW_VERSION }}"
git push

- name: Generate changelog
id: generate_changelog
run: |
Expand Down Expand Up @@ -111,3 +132,24 @@ jobs:
${{ steps.generate_changelog.outputs.CHANGELOG }}
draft: false
prerelease: false

- name: Load npm secret
uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0
with:
# Export loaded secrets as environment variables
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
# You may need to change this to your vault name and secret name
# Refer to it by calling env.NPM_TOKEN
# This token is also limited by IP to ONLY work on the runner
NPM_TOKEN: op://npm-deploy/npm-runner-token/secret

- name: Publish package to npm
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@uniswap/interfaces",
"version": "0.0.1",
"description": "Smart contract interfaces of Uniswap protocol smart contracts",
"repository": {
"type": "git",
"url": "git+https://github.com/Uniswap/interfaces.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/Uniswap/interfaces/issues"
},
"homepage": "https://github.com/Uniswap/interfaces#readme",
"publishConfig": {
"access": "public"
}
}