-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(contracts/core): add release worflows for contracts npm
- Loading branch information
1 parent
9a0fc14
commit 8055771
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Check @omni-network/contracts version | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'contracts/v*' # Trigger on contracts/v* tags | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check version | ||
run: | | ||
cd contracts/core | ||
npm_version=$(cat package.json | jq -r '.version') | ||
tag_version=${GITHUB_REF#refs/tags/contracts/v} | ||
echo "npm version: $npm_version" | ||
echo "tag version: $tag_version" | ||
if [ "$npm_version" != "$tag_version" ]; then | ||
echo "Error: package.json version '$npm_version' does not match github tag '$tag_version')" | ||
exit 1 | ||
fi | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish @omni-network/contracts to npm | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish-release: | ||
# only run for contracts/v* tags | ||
if: startsWith(github.ref, 'refs/tags/contracts/v') | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- uses: pnpm/action-setup@v4 | ||
- run: | | ||
cd contracts/core | ||
pnpm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters