Skip to content

Commit

Permalink
fix: Add release tag creation correction ⚓
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyx committed Apr 21, 2024
1 parent 7c1e65f commit de3f522
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ jobs:
RELEASE_TAG: ${{ steps.getTag.outputs.releaseTag }}
TRIGGER_TAG: ${{ steps.getTag.outputs.triggerTag }}
run: |
# go releaser already pushed release tag but it always
# does that on `main` which is wrong so we force update to the commit where it was
git push origin -f "$RELEASE_TAG"
# goreleaser already pushed release tag by the Github API.
git push origin "githooks/$RELEASE_TAG"
git push -f origin ":$TRIGGER_TAG"
1 change: 1 addition & 0 deletions githooks/.goreleaser-small.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ release:
owner: gabyx
name: githooks
prerelease: auto
target_commitish: "{{ .Commit }}"
# Use these values for you own gitea instance...
# gitea_urls:
# api: "https://git.company.com/api/v1"
Expand Down
1 change: 1 addition & 0 deletions githooks/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ release:
owner: gabyx
name: githooks
prerelease: auto
target_commitish: "{{ .Commit }}"
# Use these values for you own gitea instance...
# gitea_urls:
# api: "https://git.company.com/api/v1"
Expand Down
45 changes: 45 additions & 0 deletions tests/steps/step-146.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Test:
# Run install.sh script.
# shellcheck disable=SC2015

set -u

TEST_DIR=$(cd "$(dirname "$0")/.." && pwd)
# shellcheck disable=SC1091

. "$TEST_DIR/general.sh"

init_step

if [ -n "${GH_COVERAGE_DIR:-}" ]; then
echo "Test cannot run for coverage."
exit 249
fi

# mkdir "$GH_TEST_TMP/test-146" && cd "$GH_TEST_TMP/test-146" &&
# git clone --single-branch --branch v3.0.0-rc1 http://github.com/gabyx/githooks.git &&
# cd githooks &&
# git fetch origin refs/tags/v2.10.0:refs/tags/v2.10.0 &&
# git checkout -b feature/v3 || exit 1

# Install with current script the version 2.10.0 on the `main` branch.
"$GH_SCRIPTS/install.sh" --version 2.10.0 -- \
\
--clone-branch "feature/v3" || {
echo "Could not download install.sh from 'main' and install."
exit 1
}

# Enable this once pre-release is out on main.
# Update to version 3 and greater, which should fail due to guard.
OUT=$("$GH_INSTALL_BIN_DIR/cli" update --use-pre-release --yes)
# shellcheck disable=SC2181
if [ $? -eq 0 ] || ! echo "$OUT" | grep -iE "Too much changed. Please uninstall this version"; then
echo "Install should fail because update from v2 to v3 is guarded."
echo "$OUT"
exit 1
fi

# Uninstall right away again.
"$GH_INSTALL_BIN_DIR"/cli uninstaller || exit 1

0 comments on commit de3f522

Please sign in to comment.