diff --git a/.github/workflows/move-tag.yml b/.github/workflows/move-tag.yml deleted file mode 100644 index 2685c24..0000000 --- a/.github/workflows/move-tag.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Move tag - -# Points an existing release tag at another commit, for example after a history -# rewrite. Refuses unless the new commit's files are identical to the tagged -# commit's (same tree), so a release can never silently change content. The -# GitHub Release and its files stay attached to the tag name. - -on: - workflow_dispatch: - inputs: - tag: - description: Tag to move, e.g. v0.2.0 - required: true - commit: - description: Full commit SHA the tag should point to - required: true - -permissions: - contents: read - -jobs: - move: - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: write - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 - - name: Check and move - env: - TAG: ${{ inputs.tag }} - COMMIT: ${{ inputs.commit }} - run: | - case "$TAG" in v[0-9]*) ;; *) echo "::error::$TAG is not a release tag"; exit 1 ;; esac - git rev-parse -q --verify "refs/tags/$TAG" > /dev/null || { echo "::error::tag $TAG does not exist"; exit 1; } - old_tree="$(git rev-parse "refs/tags/$TAG^{tree}")" - new_tree="$(git rev-parse "$COMMIT^{tree}")" - echo "current: $(git rev-parse "refs/tags/$TAG^{commit}") tree $old_tree" - echo "new: $COMMIT tree $new_tree" - if [ "$old_tree" != "$new_tree" ]; then - echo "::error::the files at $COMMIT differ from $TAG; refusing to move the tag" - exit 1 - fi - git merge-base --is-ancestor "$COMMIT" "origin/${{ github.event.repository.default_branch }}" || { - echo "::error::$COMMIT is not on the default branch"; exit 1; } - git push --force origin "$COMMIT:refs/tags/$TAG" - echo "::notice::$TAG now points to $COMMIT (same files as before)" diff --git a/docs/releasing.md b/docs/releasing.md index 65a514d..01c2e29 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -68,11 +68,3 @@ its name at run time, so renaming the branch does not break releases. The workfl pushes the "Release" commit there with the built-in token. If a branch protection rule blocks that, allow GitHub Actions to bypass it, or release by merging a version bump instead. - -## Moving a release tag - -If history is ever rewritten (for example to drop files committed by mistake), a -release tag can be pointed at the rewritten copy of its commit: **Actions, Move tag, -Run workflow** with the tag and the new commit SHA. The workflow refuses unless the new -commit has exactly the same files as the tagged one and is on the default branch; the -GitHub Release and its files stay attached.