Skip to content

Commit

Permalink
fix publish ci
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjah committed Sep 30, 2024
1 parent e4243c9 commit a987baa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ jobs:
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Extract tag
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
env:
GITHUB_REF: ${{ github.ref }}

- run: ./scripts/publish.sh ${{ steps.get_tag.outputs.TAG }}
- run: ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
2 changes: 1 addition & 1 deletion packages/sc-deployer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@massalabs/massa-sc-deployer",
"version": "1.3.0",
"version": "2.0.0",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
23 changes: 5 additions & 18 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,15 @@ set -e
npm ci
npm run build

ref=$1
TAG=""
if [[ "$ref" == *"buildnet"* ]]; then
TAG="--tag buildnet"
elif [[ "$ref" == *"testnet"* ]]; then
TAG="--tag testnet"
fi

for packageDir in packages/*; do
if [ -d "$packageDir" ]; then
PACKAGE_NAME=$(cat "$packageDir/package.json" | jq -r '.name')
PUBLISH_VERSION=$(cat "$packageDir/package.json" | jq -r '.version')

# Check if the package name is in the reference
if [[ "$ref" == *"$PACKAGE_NAME"* ]]; then
echo "Publishing ${PACKAGE_NAME}@${PUBLISH_VERSION}"

cd $packageDir
npm publish --access public $TAG
cd ../..
else
echo "Skipping ${PACKAGE_NAME}"
fi
echo "Publishing ${PACKAGE_NAME}@${PUBLISH_VERSION}"

cd $packageDir
npm publish --access public --tag latest
cd ../..
fi
done

0 comments on commit a987baa

Please sign in to comment.