ci: Add script/determine-release-channel (#18476)
- Refactor duplicated inline script from ci.yml to `script/determine-release-channel` - Remove references to non-existent '-nightly' release tags Release Notes: - N/A
This commit is contained in:
parent
74cba2407f
commit
09424edc35
3 changed files with 42 additions and 72 deletions
77
.github/workflows/ci.yml
vendored
77
.github/workflows/ci.yml
vendored
|
@ -192,29 +192,12 @@ jobs:
|
||||||
- name: Determine version and release channel
|
- name: Determine version and release channel
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
# This exports RELEASE_CHANNEL into env (GITHUB_ENV)
|
||||||
|
script/determine-release-channel
|
||||||
|
|
||||||
version=$(script/get-crate-version zed)
|
- name: Draft release notes
|
||||||
channel=$(cat crates/zed/RELEASE_CHANNEL)
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
echo "Publishing version: ${version} on release channel ${channel}"
|
run: |
|
||||||
echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
expected_tag_name=""
|
|
||||||
case ${channel} in
|
|
||||||
stable)
|
|
||||||
expected_tag_name="v${version}";;
|
|
||||||
preview)
|
|
||||||
expected_tag_name="v${version}-pre";;
|
|
||||||
nightly)
|
|
||||||
expected_tag_name="v${version}-nightly";;
|
|
||||||
*)
|
|
||||||
echo "can't publish a release on channel ${channel}"
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
|
|
||||||
echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mkdir -p target/
|
mkdir -p target/
|
||||||
# Ignore any errors that occur while drafting release notes to not fail the build.
|
# Ignore any errors that occur while drafting release notes to not fail the build.
|
||||||
script/draft-release-notes "$version" "$channel" > target/release-notes.md || true
|
script/draft-release-notes "$version" "$channel" > target/release-notes.md || true
|
||||||
|
@ -289,29 +272,8 @@ jobs:
|
||||||
- name: Determine version and release channel
|
- name: Determine version and release channel
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
# This exports RELEASE_CHANNEL into env (GITHUB_ENV)
|
||||||
|
script/determine-release-channel
|
||||||
version=$(script/get-crate-version zed)
|
|
||||||
channel=$(cat crates/zed/RELEASE_CHANNEL)
|
|
||||||
echo "Publishing version: ${version} on release channel ${channel}"
|
|
||||||
echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
expected_tag_name=""
|
|
||||||
case ${channel} in
|
|
||||||
stable)
|
|
||||||
expected_tag_name="v${version}";;
|
|
||||||
preview)
|
|
||||||
expected_tag_name="v${version}-pre";;
|
|
||||||
nightly)
|
|
||||||
expected_tag_name="v${version}-nightly";;
|
|
||||||
*)
|
|
||||||
echo "can't publish a release on channel ${channel}"
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
|
|
||||||
echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Linux .tar.gz bundle
|
- name: Create Linux .tar.gz bundle
|
||||||
run: script/bundle-linux
|
run: script/bundle-linux
|
||||||
|
@ -357,29 +319,8 @@ jobs:
|
||||||
- name: Determine version and release channel
|
- name: Determine version and release channel
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
# This exports RELEASE_CHANNEL into env (GITHUB_ENV)
|
||||||
|
script/determine-release-channel
|
||||||
version=$(script/get-crate-version zed)
|
|
||||||
channel=$(cat crates/zed/RELEASE_CHANNEL)
|
|
||||||
echo "Publishing version: ${version} on release channel ${channel}"
|
|
||||||
echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
expected_tag_name=""
|
|
||||||
case ${channel} in
|
|
||||||
stable)
|
|
||||||
expected_tag_name="v${version}";;
|
|
||||||
preview)
|
|
||||||
expected_tag_name="v${version}-pre";;
|
|
||||||
nightly)
|
|
||||||
expected_tag_name="v${version}-nightly";;
|
|
||||||
*)
|
|
||||||
echo "can't publish a release on channel ${channel}"
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
|
|
||||||
echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create and upload Linux .tar.gz bundle
|
- name: Create and upload Linux .tar.gz bundle
|
||||||
run: script/bundle-linux
|
run: script/bundle-linux
|
||||||
|
|
|
@ -9,11 +9,8 @@ case $channel in
|
||||||
preview)
|
preview)
|
||||||
tag_suffix="-pre"
|
tag_suffix="-pre"
|
||||||
;;
|
;;
|
||||||
nightly)
|
|
||||||
tag_suffix="-nightly"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "this must be run on either of stable|preview|nightly release branches" >&2
|
echo "this must be run on either of stable|preview release branches" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
32
script/determine-release-channel
Executable file
32
script/determine-release-channel
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ -z "${GITHUB_ACTIONS-}" ]; then
|
||||||
|
echo "Error: This script must be run in a GitHub Actions environment"
|
||||||
|
exit 1
|
||||||
|
elif [ -z "${GITHUB_REF-}" ]; then
|
||||||
|
# This should be the release tag 'v0.x.x'
|
||||||
|
echo "Error: GITHUB_REF is not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
version=$(script/get-crate-version zed)
|
||||||
|
channel=$(cat crates/zed/RELEASE_CHANNEL)
|
||||||
|
echo "Publishing version: ${version} on release channel ${channel}"
|
||||||
|
echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
expected_tag_name=""
|
||||||
|
case ${channel} in
|
||||||
|
stable)
|
||||||
|
expected_tag_name="v${version}";;
|
||||||
|
preview)
|
||||||
|
expected_tag_name="v${version}-pre";;
|
||||||
|
*)
|
||||||
|
echo "can't publish a release on channel ${channel}"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
|
||||||
|
echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue