1+ name : Create Release on PR Merge
2+
3+ on :
4+ pull_request :
5+ types :
6+ - closed
7+ branches :
8+ - main
9+
10+ jobs :
11+ create-release :
12+ # Only run if the PR was merged (not just closed)
13+ if : github.event.pull_request.merged == true
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : write
17+
18+ steps :
19+ - name : Checkout repository
20+ uses : actions/checkout@v5
21+ with :
22+ ref : main
23+
24+ - name : Generate release tag
25+ id : tag
26+ run : |
27+ # Generate CalVer format: YY.MM.DD
28+ CALVER=$(date +'%y.%m.%d')
29+
30+ # Check if a release with this CalVer already exists
31+ COUNTER=0
32+ TAG="$CALVER"
33+
34+ # Fetch existing tags
35+ git fetch --tags
36+
37+ # Find the highest counter for today's releases
38+ while git rev-parse "refs/tags/$TAG" >/dev/null 2>&1; do
39+ COUNTER=$((COUNTER + 1))
40+ TAG="$CALVER.$COUNTER"
41+ done
42+
43+ echo "tag=$TAG" >> $GITHUB_OUTPUT
44+ echo "Generated tag: $TAG"
45+
46+ - name : Create zip archives
47+ run : |
48+ zip -r plugins.zip plugins/
49+ zip -r readmes.zip readmes/
50+ zip -r plugins-and-readmes.zip plugins/ readmes/
51+
52+ - name : Create Release
53+ uses : softprops/action-gh-release@v2
54+ with :
55+ tag_name : ${{ steps.tag.outputs.tag }}
56+ name : Release ${{ steps.tag.outputs.tag }}
57+ body : |
58+ Automatic release created from PR merge
59+
60+ **PR**: #${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }}
61+ **Merged by**: @${{ github.event.pull_request.merged_by.login }}
62+ **Commit**: ${{ github.sha }}
63+ files : |
64+ plugins.zip
65+ readmes.zip
66+ plugins-and-readmes.zip
67+ draft : false
68+ prerelease : false
0 commit comments