1+ name : merge to main workflow
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ env :
8+ BRANCH_NAME : ${{ github.event.ref.BRANCH_NAME }}
9+
10+ jobs :
11+ tag_release :
12+ runs-on : ubuntu-latest
13+ outputs :
14+ version_tag : ${{ steps.output_version_tag.outputs.VERSION_TAG }}
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v4
18+ with :
19+ ref : ${{ env.BRANCH_NAME }}
20+ fetch-depth : 0
21+
22+ # using git commit sha for version of action to ensure we have stable version
23+ - name : Install asdf
24+ uses : asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
25+ with :
26+ asdf_branch : v0.14.1
27+
28+ - name : Cache asdf
29+ uses : actions/cache@v4
30+ with :
31+ path : |
32+ ~/.asdf
33+ key : ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
34+ restore-keys : |
35+ ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
36+
37+ - name : Install asdf dependencies in .tool-versions
38+ uses : asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
39+ with :
40+ asdf_branch : v0.14.1
41+
42+ - name : Install dependencies
43+ run : |
44+ make install
45+
46+ - name : Set VERSION_TAG to be next tag varsion
47+ id : output_version_tag
48+ run : |
49+ NEXT_VERSION=$(npx semantic-release --dry-run | grep -i 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/')
50+ tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
51+ if [ "${tagFormat}" = "null" ]
52+ then
53+ tagFormat="v\${version}"
54+ fi
55+ # disabling shellcheck as replace does not work
56+ # shellcheck disable=SC2001
57+ VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
58+ echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
59+ echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
60+ echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
61+ env :
62+ GITHUB_TOKEN : ${{ github.token }}
63+
64+ - name : tag release
65+ env :
66+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67+ run : |
68+ npx semantic-release
69+
70+ - name : Get release for editing
71+ id : get_release
72+ # version 1.2.4
73+ uses : cardinalby/git-get-release-action@5172c3a026600b1d459b117738c605fabc9e4e44
74+ env :
75+ GITHUB_TOKEN : ${{ github.token }}
76+ with :
77+ tag : ${{ env.VERSION_TAG }}
78+
79+ - name : Edit Release
80+ # version 1.2.0
81+ uses : irongut/EditRelease@ccf529ad26dddf9996e7dd0f24ca5da4ea507cc2
82+ with :
83+ token : ${{ secrets.GITHUB_TOKEN }}
84+ id : ${{ steps.get_release.outputs.id }}
85+ body : |
86+ ## Info
87+ [See code diff](${{ github.event.compare }})
88+ [Release workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
89+
90+ It was initialized by [${{ github.event.sender.login }}](${{ github.event.sender.html_url }})
0 commit comments