Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ on:
push:
# Enable when testing release infrastructure on a branch.
# branches:
# - fix-releases
# - fix-releases
tags:
- 'v*'
# For now, real releases always use `workflow_dispatch`, and running the workflow on tag pushes
# is only done in testing. This is because we usually push too many tags at once for the `push`
# event to be triggered, since there are usually more than 3 crates tagged together. So the
# `push` trigger doesn't usually work. If we allow it, we risk running the workflow twice if
# it is also manually triggered based on the assumption that it would not run. See #1970 for
# details. See also the `run-release-workflow` and `roll-release` recipes in the `justfile`.
# - 'v*'
- 'v*-DO-NOT-USE' # Pattern for tags used to test the workflow (usually done in a fork).
workflow_dispatch:

permissions:
Expand Down
17 changes: 17 additions & 0 deletions etc/unique-v-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -efu
IFS=$'\n'

# shellcheck disable=SC2207 # Intentionally splitting. No globbing due to set -f.
tags=(
$(git tag --points-at HEAD -- 'v*')
)

count="${#tags[@]}"
if ((count != 1)); then
printf '%s: error: Found %d matching v* tags, need exactly 1.\n' "$0" "$count" >&2
exit 1
fi

printf '%s\n' "${tags[0]}"
17 changes: 17 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,20 @@ check-mode:
# Delete `gix-packetline-blocking/src` and regenerate from `gix-packetline/src`
copy-packetline:
etc/copy-packetline.sh

# Get the unique `v*` tag at `HEAD`, or fail with an error
unique-v-tag:
etc/unique-v-tag.sh

# Trigger the `release.yml` workflow on the current `v*` tag
run-release-workflow repo='':
optional_repo_arg={{ quote(repo) }} && \
export GH_REPO="${optional_repo_arg:-"${GH_REPO:-GitoxideLabs/gitoxide}"}" && \
tag_name="$({{ j }} unique-v-tag)" && \
printf 'Running release.yml in %s repo for %s tag.\n' "$GH_REPO" "$tag_name" && \
gh workflow run release.yml --ref "refs/tags/$tag_name"

# Run `cargo smart-release` and then trigger `release.yml` for the `v*` tag
roll-release *csr-args:
cargo smart-release {{ csr-args }}
{{ j }} run-release-workflow
Loading