Skip to content
Open
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
17 changes: 17 additions & 0 deletions .github/prepare_slim_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Create a slim folder with the minium content we want, and remove unneeded files
mkdir slim && cp -r artifacts* package.json README.md deployments slim && cd slim
find deployments -mindepth 1 -depth -not -name "*_addresses.json*" -exec rm -r "{}" +
find artifacts -mindepth 1 -depth -not -regex "artifacts/contracts.*" -exec rm -r "{}" +
find artifacts-zk -mindepth 1 -depth -not -regex "artifacts-zk/contracts.*" -exec rm -r "{}" +
find artifacts -mindepth 1 -depth -regex "artifacts/.*dbg\.json" -exec rm -r "{}" +

# Add "-slim" to the version in the npm package, keeping the tag "-dev" if it exists
jq '.version |= sub("^(?<core>[0-9]+\\.[0-9]+\\.[0-9]+)"; "\(.core)-slim")' package.json > package.tmp.json && mv package.tmp.json package.json

# Remove the "prepare" and "postinstall" scripts, they won't work for this slim version
jq 'del(.scripts.prepare)' package.json > package.tmp.json && mv package.tmp.json package.json
jq 'del(.scripts.postinstall)' package.json > package.tmp.json && mv package.tmp.json package.json

# Empty devDependencies and dependencies
jq '.dependencies = {}' package.json > package.tmp.json && mv package.tmp.json package.json
jq '.devDependencies = {}' package.json > package.tmp.json && mv package.tmp.json package.json
10 changes: 10 additions & 0 deletions .github/publish_slim_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set npm authentication
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

cd slim

# Extract to PRE_RELEASE_TAG the tag in the version field of the package json, or the empty string if it doesn't exist
PRE_RELEASE_TAG=$(jq -r '.version | if test("-") then capture("^[0-9]+\\.[0-9]+\\.[0-9]+-(?<tag>[a-zA-Z-]+)") | .tag else "" end' package.json)

# Publish the package to a custom tag for slim versions
npm publish --provenance --access public --tag $PRE_RELEASE_TAG
10 changes: 10 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -36,3 +38,11 @@ jobs:
GIT_COMMITTER_NAME: Venus Tools
GIT_COMMITTER_EMAIL: [email protected]
run: yarn semantic-release

- name: Prepare slim package
run: bash .github/prepare_slim_package.sh

- name: Publish slim package
run: bash .github/publish_slim_package.sh
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@venusprotocol/token-bridge",
"version": "2.7.1-dev.2",
"description": "Contracts to bridge tokens using LayerZero technology and applying some rules on top of it",
"repository": "[email protected]:VenusProtocol/token-bridge.git",
"files": [
"artifacts",
"typechain",
Expand Down
Loading