diff --git a/prepare/action.yml b/prepare/action.yml index 4c41e3f..787c4bf 100644 --- a/prepare/action.yml +++ b/prepare/action.yml @@ -109,8 +109,7 @@ runs: uses: actions/setup-go@v5 with: go-version: '1.26.1' - cache: true - cache-dependency-path: ${{ github.action_path }}/../go.sum + cache: false - name: Restore cached vociferate binary id: cache-vociferate @@ -192,11 +191,6 @@ runs: run: | set -euo pipefail - if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then - echo "Tag ${RELEASE_TAG} already exists" >&2 - exit 1 - fi - case "$GITHUB_SERVER_URL" in https://*) authed_remote="https://oauth2:${TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" @@ -214,11 +208,21 @@ runs: git config user.email "$GIT_USER_EMAIL" git remote set-url origin "$authed_remote" + if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1 || git ls-remote --exit-code --tags origin "refs/tags/${RELEASE_TAG}" >/dev/null 2>&1; then + echo "Tag ${RELEASE_TAG} already exists; skipping commit/tag/push." + exit 0 + fi + for f in $GIT_ADD_FILES; do git add "$f" done - git commit -m "release: prepare ${RELEASE_TAG}" + if git diff --cached --quiet; then + echo "No staged release file changes; tagging current HEAD as ${RELEASE_TAG}." + else + git commit -m "release: prepare ${RELEASE_TAG}" + fi + git tag "$RELEASE_TAG" git push origin HEAD git push origin "$RELEASE_TAG"