File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ # Automatically creates a tag for each commit to `main` so when we rebase
2+ # changes on top of the upstream, we retain permanent references to each
3+ # previous commit so they are not orphaned and eventually deleted.
4+ name : Create permanent reference
5+
6+ on :
7+ push :
8+ branches :
9+ - " main"
10+
11+ jobs :
12+ release :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : Get the permanent ref number
19+ id : get_version
20+ run : |
21+ # Enable pipefail so git command failures do not result in null versions downstream
22+ set -x
23+
24+ echo ::set-output name=LAST_PERMA_NUMBER::$(\
25+ git ls-remote --tags --refs --sort="v:refname" \
26+ https://github.com/zanieb/pubgrub.git | grep "tags/perma-" | tail -n1 | sed 's/.*\/perma-//' \
27+ )
28+
29+ - name : Configure Git
30+ run : |
31+ git config user.name "$GITHUB_ACTOR"
32+ git config user.email "[email protected] " 33+
34+ - name : Create and push the new tag
35+ run : |
36+ TAG="perma-$((LAST_PERMA_NUMBER + 1))"
37+ git tag -a "$TAG" -m "Automatically created on push to `main`"
38+ git push origin "$TAG"
39+ env :
40+ LAST_PERMA_NUMBER : ${{ steps.get_version.outputs.LAST_PERMA_NUMBER }}
You can’t perform that action at this time.
0 commit comments