From ed141788f696d3631f082bec7fee6f0d6d70c8f7 Mon Sep 17 00:00:00 2001 From: Gleiser Oliveira Date: Wed, 22 Oct 2025 16:38:46 -0600 Subject: [PATCH 1/3] feat: add slim package scripts --- .github/prepare_slim_package.sh | 17 +++++++++++++++++ .github/publish_slim_package.sh | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/prepare_slim_package.sh create mode 100644 .github/publish_slim_package.sh diff --git a/.github/prepare_slim_package.sh b/.github/prepare_slim_package.sh new file mode 100644 index 00000000..d7d06010 --- /dev/null +++ b/.github/prepare_slim_package.sh @@ -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("^(?[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 diff --git a/.github/publish_slim_package.sh b/.github/publish_slim_package.sh new file mode 100644 index 00000000..ccaa223a --- /dev/null +++ b/.github/publish_slim_package.sh @@ -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]+-(?[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 From 8beb8b4688c6b75c7f2fe6e42700ae50b38bd5cf Mon Sep 17 00:00:00 2001 From: Gleiser Oliveira Date: Wed, 22 Oct 2025 16:38:55 -0600 Subject: [PATCH 2/3] cd: publish slim package --- .github/workflows/cd.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 0d512b6a..1e52ee83 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -9,6 +9,8 @@ on: jobs: release: runs-on: ubuntu-latest + permissions: + id-token: write steps: - name: Checkout uses: actions/checkout@v3 @@ -35,3 +37,11 @@ jobs: GIT_COMMITTER_NAME: Venus Tools GIT_COMMITTER_EMAIL: tools@venus.io 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 }} From dee1291c1c71917ed3dc5b7b51868284df8c8b9f Mon Sep 17 00:00:00 2001 From: Gleiser Oliveira Date: Mon, 3 Nov 2025 15:39:46 -0600 Subject: [PATCH 3/3] fix: add repo URL --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b9cef6a1..1c7c5e85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@venusprotocol/oracle", "description": "Venus Protocol Price Oracle", + "repository": "git@github.com:VenusProtocol/oracle.git", "version": "2.15.0-dev.3", "author": "Venus", "engines": {