|
| 1 | +name: Release - Move Tracking Tag |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + Move-Tracking-Tag-To-Latest-Release: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + # We have a choice - defensiveness vs convenience: |
| 12 | + # 1. Be defensive by filtering if the release doesn't look like a normal |
| 13 | + # version, or if it's a patch release to an older version... the logic |
| 14 | + # gets tricky quickly. Easiest way to be 100% sure is stop running this |
| 15 | + # on `release` and instead require a human to manually run this workflow |
| 16 | + # after they tag a release. |
| 17 | + # 2. Minimize the upfront hassle by assuming every release is a normal |
| 18 | + # version release and the latest one. Today both are resoundingly true |
| 19 | + # as this repo isn't that active/busy, so we don't worry about |
| 20 | + # multiple release branches, pre-releases, etc. |
| 21 | + # |
| 22 | + # For now I've gone with option 2, as it is much more convenient and if we |
| 23 | + # typo something during a release it's easy to fix by immediately tagging a |
| 24 | + # correct release. And if we don't notice the typo, well, in that case |
| 25 | + # requiring a human to manually run the workflow wouldn't have protected us |
| 26 | + # either, we'd have had to filter by only things that look like versions. |
| 27 | + # Anyway, for now this is good enough, and if it gets to be a problem down |
| 28 | + # the road we increase the robustness of this. |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v3 |
| 32 | + with: |
| 33 | + token: ${{ secrets.DEPENDABOT_AUTOMATION_PAT }} |
| 34 | + |
| 35 | + - name: Move the tracking tag |
| 36 | + run: git tag -f v1 |
| 37 | + |
| 38 | + - name: Push the new tag value back to the repo |
| 39 | + run: git push -f origin refs/tags/v1 |
| 40 | + |
| 41 | + - name: Set summary |
| 42 | + run: | |
| 43 | + echo ":rocket: Successfully moved the \`v1\` tag to point at release: ${{ github.event.release.name }} with SHA: \`$GITHUB_SHA\`." >> $GITHUB_STEP_SUMMARY |
0 commit comments