Skip to content

Commit

Permalink
chore: Updated GitHub Workflow for RC Versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
seeratawan01 committed Oct 23, 2024
1 parent 5b7cc15 commit d499e9e
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/cd-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,55 @@ jobs:
- name: Set token
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > ~/.npmrc

- name: Set package version to RC version
- name: Update package versions and dependencies
run: |
RC_VERSION="${{ steps.rc_version.outputs.RC_VERSION }}"
# First update SDK version
cd packages/javascript-sdk
npm version $RC_VERSION --no-git-tag-version
SDK_VERSION=$(node -p "require('./package.json').version")
cd ../..
# Then update other packages and their dependencies
for package in packages/*; do
if [ -d "$package" ]; then
echo "Setting version for $package to $RC_VERSION"
if [ -d "$package" ] && [ "$package" != "packages/javascript-sdk" ]; then
echo "Processing $package"
cd $package
npm version $RC_VERSION --no-git-tag-version
cd - > /dev/null
fi
# Update package version
npm version $RC_VERSION --no-git-tag-version
# Update workspace dependency to specific version
if [ -f "package.json" ]; then
sed -i.bak "s|\"@usermaven/sdk-js\": \"workspace:\\*\"|\"@usermaven/sdk-js\": \"$SDK_VERSION\"|" package.json
rm package.json.bak
fi
cd ../..
fi
done
- name: Publishing RC SDK package
- name: Publishing RC packages
run: |
# Publish SDK first
cd packages/javascript-sdk
echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > .npmrc
npm publish --tag rc --access=public
cd ../..
# Wait a bit for the SDK package to be available
sleep 10
# Then publish other packages
for package in packages/*; do
if [ -d "$package" ]; then
if [ -d "$package" ] && [ "$package" != "packages/javascript-sdk" ]; then
cd $package
echo "Publishing $package RC SDK package"
echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > .npmrc
npm publish --tag rc --no-workspaces --access=public
cd - > /dev/null
fi
echo "Publishing $package"
echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > .npmrc
npm publish --tag rc --access=public
cd ../..
fi
done
- name: Deploy to BunnyCDN
Expand Down

0 comments on commit d499e9e

Please sign in to comment.