File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Create release
2+
3+ on :
4+ push :
5+ tags : ["v*.*.*"]
6+
7+ jobs :
8+ create-release :
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : write
12+ env :
13+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v6
17+ with :
18+ fetch-depth : 0
19+
20+ - name : Determine previous tag
21+ id : prev
22+ run : |
23+ CURRENT_TAG="${GITHUB_REF_NAME}"
24+ PREV_TAG=$(git tag --sort=-creatordate | grep '^v' | grep -v "^${CURRENT_TAG}$" | head -n 1 || true)
25+
26+ echo "Current tag: $CURRENT_TAG"
27+ echo "Previous tag: $PREV_TAG"
28+
29+ echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
30+
31+ - name : Create GitHub release
32+ env :
33+ CURRENT_TAG : ${{ github.ref_name }}
34+ PREV_TAG : ${{ steps.prev.outputs.prev_tag }}
35+ run : |
36+ REPO="${{ github.repository }}"
37+
38+ if [ -n "${PREV_TAG}" ]; then
39+ BODY="Changelog: https://github.com/${REPO}/compare/${PREV_TAG}...${CURRENT_TAG}"
40+ else
41+ BODY="Initial release"
42+ fi
43+
44+ echo "Creating release for tag: ${CURRENT_TAG}"
45+ echo "Release notes: ${BODY}"
46+
47+ gh release create "${CURRENT_TAG}" \
48+ --title "${CURRENT_TAG}" \
49+ --notes "${BODY}"
You can’t perform that action at this time.
0 commit comments