Skip to content

ci: Do release tagging in CI and add --draft support #5652

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

Merged
merged 17 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Ignore metadata to test workflow
  • Loading branch information
mafredri committed Jan 10, 2023
commit b7fc031c565bff432afe816903d45cf0f8e725ac
6 changes: 6 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ permissions:

env:
CODER_RELEASE: ${{ github.event.inputs.snapshot && 'false' || 'true' }}
DRY_RUN: ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && 'true' || 'false' }}

jobs:
release:
Expand Down Expand Up @@ -115,6 +116,11 @@ jobs:
ref=HEAD
old_version="$(git describe --abbrev=0 "$ref^1")"

if [[ $DRY_RUN == true ]]; then
# Allow dry-run of branches to pass.
export CODER_IGNORE_MISSING_COMMIT_METADATA=1
fi

# Cache commit metadata.
. ./scripts/release/check_commit_metadata.sh "$old_version" "$ref"

Expand Down
17 changes: 12 additions & 5 deletions scripts/release/check_commit_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ if [[ -z $to_ref ]]; then
error "No to_ref specified"
fi

ignore_missing_metadata=${CODER_IGNORE_MISSING_COMMIT_METADATA:-0}
if [[ $ignore_missing_metadata == 1 ]]; then
log "WARNING: Ignoring missing commit metadata, breaking changes may be missed."
fi

range="$from_ref..$to_ref"

# Check dependencies.
Expand Down Expand Up @@ -91,9 +96,11 @@ main() {
commit_sha_long=${parts[1]}
commit_prefix=${parts[2]}

# Safety-check, guarantee all commits had their metadata fetched.
if [[ ! -v labels[$commit_sha_long] ]]; then
error "Metadata missing for commit $commit_sha_short"
if [[ $ignore_missing_metadata != 1 ]]; then
# Safety-check, guarantee all commits had their metadata fetched.
if [[ ! -v labels[$commit_sha_long] ]]; then
error "Metadata missing for commit $commit_sha_short"
fi
fi

# Store the commit title for later use.
Expand All @@ -103,11 +110,11 @@ main() {

# First, check the title for breaking changes. This avoids doing a
# GH API request if there's a match.
if [[ $commit_prefix =~ $breaking_title ]] || [[ ${labels[$commit_sha_long]} = *"label:$breaking_label"* ]]; then
if [[ $commit_prefix =~ $breaking_title ]] || [[ ${labels[$commit_sha_long]:-} = *"label:$breaking_label"* ]]; then
COMMIT_METADATA_CATEGORY[$commit_sha_short]=$breaking_category
COMMIT_METADATA_BREAKING=1
continue
elif [[ ${labels[$commit_sha_long]} = *"label:$security_label"* ]]; then
elif [[ ${labels[$commit_sha_long]:-} = *"label:$security_label"* ]]; then
COMMIT_METADATA_CATEGORY[$commit_sha_short]=$security_label
continue
fi
Expand Down