mirror of
https://github.com/starship/starship.git
synced 2024-11-25 09:43:36 +01:00
ci: Fix how version is obtained for pkgbuild (#5443)
* fix: Change how starship version is determined * Add STARSHIP_VERSION envar into CI for notarization * More strict! * Supress pushd/popd output * Fix shellcheck issue with quoting
This commit is contained in:
parent
8168c21293
commit
001253cebe
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -176,6 +176,7 @@ jobs:
|
||||
env:
|
||||
KEYCHAIN_FILENAME: app-signing.keychain-db
|
||||
KEYCHAIN_ENTRY: AC_PASSWORD
|
||||
STARSHIP_VERSION: ${{ needs.release_please.outputs.tag_name }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
|
||||
|
@ -87,4 +87,4 @@ trap - INT
|
||||
|
||||
# Build the component package
|
||||
version="$(starship_version "$starship_program_file")"
|
||||
pkgbuild --identifier com.starshipprompt.starship --version "$version" --root $pkgdir starship-component.pkg
|
||||
pkgbuild --identifier com.starshipprompt.starship --version "$version" --root "$pkgdir" starship-component.pkg
|
||||
|
@ -11,12 +11,20 @@ starship_version() {
|
||||
if [ "$1" = "${1#/}" ]; then
|
||||
starship_program_file="./$starship_program_file"
|
||||
fi
|
||||
if "$starship_program_file" -V 2>&1 >/dev/null; then
|
||||
"$starship_program_file" -V | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
|
||||
# Try to get the version from three sources in the following order:
|
||||
# - the STARSHIP_VERSION envar (usually set by the CI)
|
||||
# - Running the binary file
|
||||
# - By cutting out the first version tag in Cargo.toml
|
||||
# These get increasingly fragile as we go down the list---ideally CI should
|
||||
# always run with STARSHIP_VERSION set to avoid issues in determining version.
|
||||
if [ "$STARSHIP_VERSION" != "" ]; then
|
||||
echo "$STARSHIP_VERSION" | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
elif "$starship_program_file" -V >/dev/null 2>&1; then
|
||||
"$starship_program_file" -V 2> /dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
else
|
||||
# try to get this information from Cargo.toml
|
||||
pushd "$(git rev-parse --show-toplevel)" || true
|
||||
grep '^version = \"\(.*\)\"' Cargo.toml | cut -f 2 -d '"'
|
||||
popd
|
||||
pushd "$(git rev-parse --show-toplevel)" &> /dev/null || true
|
||||
grep '^version = \"\(.*\)\"' Cargo.toml | head -n 1 | cut -f 2 -d '"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
popd &> /dev/null || true
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user