Skip to content

Commit 5e828c2

Browse files
authored
auto tag when Project.toml updated (#54)
1 parent 4ef0e4b commit 5e828c2

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.github/workflows/BuildDylib.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
uses: julia-actions/setup-julia@latest
2626
with:
2727
version: ${{ matrix.julia-version }}
28+
- name: Tag commit
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: deps/gh-auto-tag
2832
- name: Install dependencies
2933
run: julia -e 'using Pkg; Pkg.add("BinaryProvider"); Pkg.add("BinaryBuilder");'
3034
- name: Build

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,5 @@ Disclaimer: This feature is still experimental and should only be used with caut
8080
## For Developer
8181

8282
### Release a new version
83-
1. Update the new version number in `Project.toml`;
84-
2. Commit all the changes;
85-
3. Tag the current commit with git, the tag name should be version number with a preceding "v";
86-
4. Push the tag to the repo on GitHub, then make a release on the tag.
83+
Update the new version number in `Project.toml`, a tag to that
84+
version will be made by the GitHub Actions after it is pushed.

deps/gh-auto-tag

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
git fetch --tags
4+
5+
TAGS=($(git tag))
6+
CTAG=$(perl -ne 'print "v$1" if m#version\s*=\s*"(.*)"#' Project.toml)
7+
COMMIT=$(git rev-parse HEAD)
8+
9+
if [[ ! " ${TAGS[@]} " =~ " ${CTAG} " ]]; then
10+
GIT_REFS_URL=$(jq .repository.git_refs_url $GITHUB_EVENT_PATH | tr -d '"' | sed 's/{\/sha}//g')
11+
12+
curl -s -X POST $GIT_REFS_URL \
13+
-H "Authorization: token ${GITHUB_TOKEN}" \
14+
-d @- << EOF
15+
{
16+
"ref": "refs/tags/$CTAG",
17+
"sha": "$COMMIT"
18+
}
19+
EOF
20+
21+
fi

0 commit comments

Comments
 (0)