From ce6e65ac5e0b0c7821a6eab439b094fc03e161f8 Mon Sep 17 00:00:00 2001 From: benoit Date: Fri, 7 Feb 2025 02:00:07 +0000 Subject: [PATCH] add better logging for bash scripts --- .github/workflows/create-release.yaml | 1 + .github/workflows/deploy-stage.yaml | 3 +++ .github/workflows/tag-release.yaml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index 03aaba1..c249568 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -21,6 +21,7 @@ jobs: - run: | set -evo pipefail + trap 'echo "Error occurred at line $LINENO: $BASH_COMMAND";' ERR DATE_TODAY=$(date +"%Y-%m-%d") diff --git a/.github/workflows/deploy-stage.yaml b/.github/workflows/deploy-stage.yaml index add0b95..a5287fb 100644 --- a/.github/workflows/deploy-stage.yaml +++ b/.github/workflows/deploy-stage.yaml @@ -105,6 +105,9 @@ jobs: - name: build the CLI run: | + set -evo pipefail + trap 'echo "Error occurred at line $LINENO: $BASH_COMMAND";' ERR + # If we're on a tag, use the tag name as the release version. if [[ "$GITHUB_REF_TYPE" == 'tag' ]]; then # Ensure that the version specified in Cargo.toml is the same as the tag (with a 'v' prefix). diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml index 3aaf55c..bac65eb 100644 --- a/.github/workflows/tag-release.yaml +++ b/.github/workflows/tag-release.yaml @@ -26,6 +26,9 @@ jobs: - name: Read version from Cargo.toml and push appropriate tag id: read-version run: | + set -evo pipefail + trap 'echo "Error occurred at line $LINENO: $BASH_COMMAND";' ERR + CARGO_VERSION="$(cargo metadata --format-version=1 | jq -r '.packages | .[] | select(.name == "ndc-clickhouse-cli") | .version')" VERSION_TAG="v$CARGO_VERSION" if git rev-parse "$VERSION_TAG" >/dev/null 2>&1; then