Skip to content

Commit

Permalink
Merge branch 'main' into feat/use-sbom-api-v2024-04-22
Browse files Browse the repository at this point in the history
  • Loading branch information
dekelund committed Apr 29, 2024
2 parents 7381f22 + 7e1499d commit 2060f01
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Expand Up @@ -1220,7 +1220,7 @@ jobs:
command: make binary-releases/release.json
- run:
name: Making release notes
command: make binary-releases/RELEASE_NOTES.md
command: make binary-releases/RELEASE_NOTES.md binary-releases/fips/RELEASE_NOTES.md
- run:
name: Validating artifacts
command: ./release-scripts/validate-checksums.sh
Expand All @@ -1244,6 +1244,7 @@ jobs:
- binary-releases/snyk.tgz
- binary-releases/ls-protocol-version-*
- binary-releases/fips/ls-protocol-version-*
- binary-releases/fips/RELEASE_NOTES.md

pre-release:
executor: docker-amd64
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Expand Up @@ -94,11 +94,10 @@ $(BINARY_OUTPUT_FOLDER)/release.json:
# :(exclude) syntax: https://git-scm.com/docs/gitglossary.html#Documentation/gitglossary.txt-exclude
# Release notes uses version from package.json so we need to prepack beforehand.
$(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
npx conventional-changelog-cli -l -r 1 -n ./release-scripts/conventional-changelog-cli-config.js > $(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
$(BINARY_OUTPUT_FOLDER)/fips/RELEASE_NOTES.md: $(BINARY_OUTPUT_FOLDER)/RELEASE_NOTES.md $(BINARY_OUTPUT_FOLDER)/fips
@cp $(BINARY_OUTPUT_FOLDER)/RELEASE_NOTES.md $(BINARY_OUTPUT_FOLDER)/fips/RELEASE_NOTES.md

# Generates a shasum of a target with the same name.
# See "Automatic Variables" in GNU Make docs (linked at the top)
Expand Down
1 change: 1 addition & 0 deletions check-dependencies.config.ts
Expand Up @@ -12,6 +12,7 @@ export const config: Options = {
'ts-node', // used for various scripts to avoid separate compile step
'jest-junit', // used for CI test reporting
'@types/node', // node types used for alerts
'conventional-changelog-conventionalcommits', // used to configure generating release notes
],
ignoreDirs: ['node_modules', 'dist', 'fixtures', 'test-output'],
};
10 changes: 10 additions & 0 deletions release-scripts/conventional-changelog-cli-config.js
@@ -0,0 +1,10 @@
'use strict';
const config = require('conventional-changelog-conventionalcommits');

const headerExtension = `
The Snyk CLI is being deployed to different deployment channels, users can select the stability level according to their needs. For details please see [this documentation](https://docs.snyk.io/snyk-cli/releases-and-channels-for-the-snyk-cli)`;

module.exports = config({}).then((preset) => {
preset.conventionalChangelog.writerOpts.headerPartial += headerExtension;
return preset;
});
10 changes: 3 additions & 7 deletions release-scripts/next-version.sh
Expand Up @@ -7,23 +7,19 @@ 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)"

valid_version_postfixes=("preview" "rc")
postfix="-dev.$(git rev-parse HEAD)"
valid_version_postfixes=("preview" "rc" "dev")
postfix=""

if [ "$RELEASE_CHANNEL" != "" ]; then
# Check if the input string is in the list of valid strings
for valid_str in "${valid_version_postfixes[@]}"; do
if [ "$RELEASE_CHANNEL" == "$valid_str" ]; then
postfix="-$RELEASE_CHANNEL"
postfix="-$RELEASE_CHANNEL.$(git rev-parse HEAD)"
break
fi
done
fi

if [ "$RELEASE_CHANNEL" == "stable" ]; then
postfix=""
fi

NEXT_VERSION="${NEXT_VERSION}${postfix}"

echo "Current version: ${CURRENT_TAG/v/}" 1>&2
Expand Down
4 changes: 4 additions & 0 deletions release-scripts/prepare-release.sh
Expand Up @@ -24,6 +24,10 @@ fi
# Generate the release notes baseline from the commits
make binary-releases/RELEASE_NOTES.md clean-package-files format

# if the release 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 "version" -e "s/$(cat binary-releases/version)/$(npx semver --coerce $(cat binary-releases/version))/g" binary-releases/RELEASE_NOTES.md

# Commit and push the release notes
git add -f binary-releases/RELEASE_NOTES.md
git commit -m "docs: update release notes"
Expand Down
4 changes: 4 additions & 0 deletions release-scripts/upload-artifacts.sh
Expand Up @@ -135,25 +135,29 @@ upload_s3() {
done
aws s3 cp "binary-releases/release.json" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/ --dryrun
aws s3 cp "binary-releases/version" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/ --dryrun
aws s3 cp "binary-releases/RELEASE_NOTES.md" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/ --dryrun

for filename in "${StaticFilesFIPS[@]}"; do
aws s3 cp "${filename}" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/ --dryrun
done
aws s3 cp "binary-releases/fips/release.json" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/ --dryrun
aws s3 cp "binary-releases/fips/version" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/ --dryrun
aws s3 cp "binary-releases/fips/RELEASE_NOTES.md" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/ --dryrun
else
echo "Uploading to S3..."
for filename in "${StaticFiles[@]}"; do
aws s3 cp "${filename}" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/
done
aws s3 cp "binary-releases/release.json" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/
aws s3 cp "binary-releases/version" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/
aws s3 cp "binary-releases/RELEASE_NOTES.md" s3://"${PUBLIC_S3_BUCKET}"/cli/"${version_target}"/

for filename in "${StaticFilesFIPS[@]}"; do
aws s3 cp "${filename}" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/
done
aws s3 cp "binary-releases/fips/release.json" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/
aws s3 cp "binary-releases/fips/version" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/
aws s3 cp "binary-releases/fips/RELEASE_NOTES.md" s3://"${PUBLIC_S3_BUCKET}"/fips/cli/"${version_target}"/
fi
}

Expand Down

0 comments on commit 2060f01

Please sign in to comment.