From 7b256a8e79281d0bf332e4d014306a558906bbb8 Mon Sep 17 00:00:00 2001 From: Ben Elan Date: Tue, 14 May 2024 14:52:45 -0700 Subject: [PATCH] ci: setup hotfix releasing scripts and settings (#9337) **Related Issue:** N/A Setup continuous integration for releasing hotfixes from a separate branch so normal work can continue on `main`. --- .github/workflows/deploy-latest.yml | 19 ++++++++++++++++--- support/release.sh | 8 ++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-latest.yml b/.github/workflows/deploy-latest.yml index ca9a5c8223d..c5d4b4ae97e 100644 --- a/.github/workflows/deploy-latest.yml +++ b/.github/workflows/deploy-latest.yml @@ -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: diff --git a/support/release.sh b/support/release.sh index a7c2c902feb..1ef3efb7889 100755 --- a/support/release.sh +++ b/support/release.sh @@ -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 []" @@ -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} }