@@ -3,66 +3,22 @@ name: Create Release
33on :
44 push :
55 branches :
6- - main
6+ - ' main'
7+ - ' master'
78 paths :
89 - ' lean-toolchain'
910
1011jobs :
11- create_release :
12+ lean-release-tag :
13+ name : Add Lean release tag
1214 runs-on : ubuntu-latest
13-
15+ permissions :
16+ contents : write
1417 steps :
15- - name : Checkout code
16- uses : actions/checkout@v6
17- with :
18- fetch-depth : 2 # Fetch the last two commits for comparison
19-
20- - name : Check if lean-toolchain has changed
21- id : check_file_change
22- run : |
23- # Check if the lean-toolchain file was modified in the last commit
24- if git diff --name-only HEAD~1 HEAD | grep -q "^lean-toolchain$"; then
25- echo "CHANGED=true" >> $GITHUB_ENV
26- else
27- echo "CHANGED=false" >> $GITHUB_ENV
28- fi
29-
30- - name : Exit if lean-toolchain did not change
31- if : env.CHANGED != 'true'
32- run : echo "No changes in lean-toolchain. Skipping release."
33-
34- - name : Read Lean version from lean-toolchain
35- if : env.CHANGED == 'true'
36- id : get_version
37- run : |
38- # Extract the version from the lean-toolchain file (everything after the colon)
39- LEAN_VERSION=$(cut -d ':' -f2 < lean-toolchain | tr -d '[:space:]')
40- echo "tag_name=${LEAN_VERSION}" >> $GITHUB_ENV
41-
42- - name : Create Git tag
43- if : env.CHANGED == 'true'
44- run : |
45- git config user.name "github-actions[bot]"
46- git config user.email "github-actions[bot]@users.noreply.github.com"
47- git tag -a ${{ env.tag_name }} -m "Release ${{ env.tag_name }}"
48- git push origin ${{ env.tag_name }}
49-
50- - name : Create GitHub Release
51- if : env.CHANGED == 'true'
52- uses : actions/github-script@v9
53- env :
54- tag_name : ${{ env.tag_name }}
55- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56- with :
57- script : |
58- const tagName = process.env.tag_name;
59- const releaseName = `${tagName}`;
60- await github.rest.repos.createRelease({
61- owner: context.repo.owner,
62- repo: context.repo.repo,
63- tag_name: tagName,
64- name: releaseName,
65- body: `Automated release for Lean version ${tagName}`,
66- draft: false,
67- prerelease: false
68- });
18+ - name : lean-release-tag action
19+ uses : leanprover-community/lean-release-tag@9ca7ed09e240259871327bfc3a3a8d8c4bcb41aa # 2025-05-22
20+ with :
21+ before : ${{ github.event.before }}
22+ after : ${{ github.event.after }}
23+ do-release : true
24+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments