Skip to content

Commit

Permalink
ci: setup hotfix releasing scripts and settings (#9379)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

Cherry-pick the hotfix CI setup. The commit on `main` includes a fix for
release errors due to an outdated `package-lock.json`.

For example:
https://github.com/Esri/calcite-design-system/actions/runs/9084873297/job/24966844402#step:5:638
  • Loading branch information
benelan committed May 21, 2024
1 parent 34a2bbe commit 9727a56
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/deploy-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,22 @@ jobs:
# For more info, see: https://github.com/Esri/calcite-design-system/pull/9011
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# the "|| true" prevents failure if there are no changes
git add packages/calcite-components/src/components.d.ts || true
git commit -m "build: update types" || true
# The "|| true" prevents failure if there are no changes
git add packages/calcite-components/src/components.d.ts package-lock.json || true
# The release-please PR only updates when there are new deployable
# commits, e.g., fixes, features, or breaking changes. This is fine
# but it means autogenerated files can become outdated.
#
# Lerna will only publish when the working tree is clean, so changes
# to autogenerated files cause the release to fail.
#
# The workaround is to commit the files before releasing so everything
# will be up to date in the dists. The commit will be discarded once
# the container is destroyed, and then the autogenerated files will be
# updated in a subsequent PR.
git commit -m "build: update types and package-lock" || true
npm run publish:latest
env:
Expand Down
8 changes: 8 additions & 0 deletions support/release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash
set -e

# This script is used to version and publish releases and pre-releases.
#
# @arg1 The deployment step to run, must be either "version" or "publish".
# @arg2 [optional] The pre-release tag, e.g., "next", "hotfix", or "rc".
# Omit this optional argument for a "latest" release

help() {
[ -n "$1" ] && printf "%s\n" "$@"
echo "Usage: ./release.sh <version | publish> [<pre-release-tag>]"
Expand Down Expand Up @@ -43,10 +49,12 @@ version() {
--preid "$dist_tag"
fi

# default to latest if no dist tag was provided in the second argument
npm run util:sync-linked-package-versions -- "${dist_tag:-latest}"
}

publish() {
# only add the dist-tag flag if the second argument was provided
lerna publish from-package --yes ${dist_tag:+--dist-tag $dist_tag}
}

Expand Down

0 comments on commit 9727a56

Please sign in to comment.