diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 970355a..948f2fe 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -134,6 +134,10 @@ echo_info "Checking release tag" echo_info "--------------------------------------------" echo_info "" +echo_info "---< git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true >---" +git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true +echo "" + readonly EXISTING_TAG=`git rev-parse -q --verify "refs/tags/v${RELEASE_VERSION}"` || true if [[ -n "${EXISTING_TAG}" ]]; then echo_warn "Tag v${RELEASE_VERSION} already exists. Exiting." @@ -155,8 +159,8 @@ echo_info "Generating changelog" echo_info "--------------------------------------------" echo_info "" -echo_info "---< git fetch origin main >---" -git fetch origin main +echo_info "---< git fetch origin main --prune --unshallow >---" +git fetch origin main --prune --unshallow echo "" echo_info "Generating changelog from history..." @@ -166,11 +170,11 @@ echo "$CHANGELOG" # Parse and preformat the text to handle multi-line output. # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string -FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"` +FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "[INFO]"` EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) -echo "changelog=<<$EOF" >> "$GITHUB_OUTPUT" -echo $CHANGELOG >> "$GITHUB_OUTPUT" -echo $EOF >> "$GITHUG_OUTPUT" +echo "changelog<<$EOF" >> "$GITHUB_OUTPUT" +echo "$CHANGELOG" >> "$GITHUB_OUTPUT" +echo "$EOF" >> "$GITHUB_OUTPUT" echo "" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bdd249a..1d92079 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,9 +25,10 @@ jobs: # To publish a release, merge the release PR with the label 'release:publish'. # To stage a release without publishing it, manually invoke the workflow. # . or apply the 'release:stage' label to a PR. - if: (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) || + if: > + (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) || github.event.workflow_dispatch || - contains(github.event.pull_request.labels.*.name, 'release:stage') + (!github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:stage')) runs-on: ubuntu-latest