Skip to content

Commit

Permalink
chore(ci): Enable preview and stable deployments (#5178)
Browse files Browse the repository at this point in the history
* chore(ci): enable stable release channels

* chore: add release scripts to makefile

* chore: add additional instructions to prepare-release

* chore: run formatter after generating release notes

* chore: remove unused variable

* chore: ensure to use the correct version in release notes

* chore: use correct version in create-release

* chore: use long form of semver --coerce

* chore: add comment on version cleanup
  • Loading branch information
PeterSchafer authored Apr 19, 2024
1 parent 77d8bfe commit dcce4d4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ $(BINARY_OUTPUT_FOLDER)/release.json:
$(BINARY_OUTPUT_FOLDER)/RELEASE_NOTES.md: prepack | $(BINARY_RELEASES_FOLDER_TS_CLI)
npx conventional-changelog-cli -p angular -l -r 1 > $(BINARY_OUTPUT_FOLDER)/RELEASE_NOTES.md

# if the releease notes are generated locally, the version contains something like X.Y.Z-dev.hash
# the replacement below ensures that the version in the RELEASE_NOTES.md is X.Y.Z
sed -i '' -e "s/$(shell cat $(BINARY_OUTPUT_FOLDER)/version)/$(shell npx semver --coerce $(shell cat $(BINARY_OUTPUT_FOLDER)/version))/g" $(BINARY_OUTPUT_FOLDER)/RELEASE_NOTES.md

# Generates a shasum of a target with the same name.
# See "Automatic Variables" in GNU Make docs (linked at the top)
%.sha256:
Expand Down Expand Up @@ -263,6 +267,16 @@ release-pre:
@echo "-- Publishing to S3 /version"
@./release-scripts/upload-artifacts.sh version

.PHONY: release-mgt-prepare
release-mgt-prepare:
@echo "-- Preparing release"
@./release-scripts/prepare-release.sh

.PHONY: release-mgt-create
release-mgt-create:
@echo "-- Creating stable release"
@./release-scripts/create-release.sh

.PHONY: format
format:
@echo "-- Formatting code"
Expand Down
2 changes: 1 addition & 1 deletion release-scripts/create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ echo "Validating next version..."

# Get version from version file
VERSION_FILE="./binary-releases/version"
CURRENT_VERSION=$(cat "$VERSION_FILE")
CURRENT_VERSION=$(npx semver --coerce $(cat $VERSION_FILE))

# Get version from RELEASE_NOTES.md
RELEASE_NOTES_MD="./binary-releases/RELEASE_NOTES.md"
Expand Down
2 changes: 1 addition & 1 deletion release-scripts/enable-stable-release-channels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
set -euo pipefail

# enable support for stable, preview and other release channels
ENABLE_STABLE_CHANNELS=false
ENABLE_STABLE_CHANNELS=true
echo $ENABLE_STABLE_CHANNELS
1 change: 0 additions & 1 deletion release-scripts/next-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ set -euo pipefail
# Checks the latest version of Snyk CLI on npm and decides the next version.
# Only output the next version to stdout. All other output should go to stderr.

RELEASE_BRANCH="main"
NEXT_VERSION="$(convco version --bump)"
CURRENT_TAG="$(git describe --tags `git rev-list --tags --max-count=1`)"
RELEASE_CHANNEL="$($(dirname "$0")/determine-release-channel.sh)"
Expand Down
8 changes: 7 additions & 1 deletion release-scripts/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ echo "Generating release notes…"
# Delete existing release notes
if [ -f binary-releases/RELEASE_NOTES.md ]; then
rm binary-releases/RELEASE_NOTES.md
rm binary-releases/version
fi

# Generate the release notes baseline from the commits
make binary-releases/RELEASE_NOTES.md
make binary-releases/RELEASE_NOTES.md clean-package-files format

# Commit and push the release notes
git add -f binary-releases/RELEASE_NOTES.md
Expand All @@ -48,3 +49,8 @@ else
exit 1
fi

echo "\n#################################################################################################"
echo "# Next Steps:"
echo "# 1. [optional] take a look at the release notes, edit and push changes if necessary. (binary-releases/RELEASE_NOTES.md)"
echo "# 2. Mark the created PR for review and merge it as soon as approved."
echo "#################################################################################################"

0 comments on commit dcce4d4

Please sign in to comment.