Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publishing docs to gh pages #704

Merged
merged 1 commit into from
Jan 31, 2025
Merged
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
4 changes: 3 additions & 1 deletion scripts/deploy-cargo
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ local_version=$(awk '
# Get the published version from cargo
published_version=$(cargo search $package_name | awk 'NR==1 { gsub(/"/, "", $3); print $3 }')

function semver { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }

# Compare versions
if [ "$local_version" = "$published_version" ]; then
if [ "$(semver $local_version)" -le "$(semver $published_version)" ]; then
echo "Version $local_version is already published to cargo"
exit 0
fi
Expand Down
6 changes: 4 additions & 2 deletions scripts/deploy-docs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ local_version=$(jq -r ".version" package.json)
# Get the published version from github
published_version=$(curl -s https://orca-so.github.io/whirlpools/ | grep -o '<meta itemprop="version" content="[^"]*"' | cut -d'"' -f4)

function semver { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }

# Compare versions
if [ "$local_version" = "$published_version" ]; then
if [ "$(semver $local_version)" -le "$(semver $published_version)" ]; then
echo "Version $local_version is already published"
exit 0
fi

# Upload artifact
echo "Publishing version $local_version to gh"
gh-pages -f -d dist -b docs --nojekyll > /dev/null
NODE_DEBUG=gh-pages gh-pages -f -d dist -b docs --nojekyll > /dev/null
4 changes: 3 additions & 1 deletion scripts/deploy-npm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ local_version=$(jq -r ".version" package.json)
# Get the published version from npm
published_version=$(npm view $package_name version 2>/dev/null || true)

function semver { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }

# Compare versions
if [ "$local_version" = "$published_version" ]; then
if [ "$(semver $local_version)" -le "$(semver $published_version)" ]; then
echo "Version $local_version is already published to npm"
exit 0
fi
Expand Down