1- name : Lint
1+ name : Create Release
22
33on :
44 workflow_call :
55
66jobs :
77 release :
88 runs-on : ubuntu-latest
9- if : github.ref == 'refs/heads/main' # Only run on main branch
10-
9+ if : github.ref == 'refs/heads/main'
1110 steps :
12- - name : Checkout code
13- uses : actions/checkout@v4
11+ - uses : actions/checkout@v4
1412 with :
15- fetch-depth : 0 # Fetch all history
16- ref : main # Explicitly checkout main branch
13+ fetch-depth : 0
1714
18- - name : Set up Python
19- uses : actions/setup-python@v5
20- with :
21- python-version : ' 3.12'
22-
23- - name : Install Poetry
24- run : |
25- pip install poetry
15+ - uses : ./.github/actions/setup-env
2616
2717 - name : Read version from pyproject.toml
2818 id : get_version
3121 echo "VERSION=${VERSION}" >> $GITHUB_ENV
3222
3323 - name : Check if release exists
34- id : check_release
3524 run : |
3625 RELEASE_EXISTS=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.VERSION }})
3726 if [ "$RELEASE_EXISTS" == "404" ]; then
@@ -42,17 +31,14 @@ jobs:
4231
4332 - name : Find Previous Release
4433 if : env.CREATE_RELEASE == 'true'
45- id : previous_release
4634 run : |
47- git fetch --tags
4835 PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
4936 if [ -n "$PREV_TAG" ]; then
5037 echo "PREV_TAG=${PREV_TAG}" >> $GITHUB_ENV
5138 fi
5239
5340 - name : Generate Compare URL
5441 if : env.CREATE_RELEASE == 'true'
55- id : compare_url
5642 run : |
5743 if [ -n "${{ env.PREV_TAG }}" ]; then
5844 echo "URL=${{ github.server_url }}/${{ github.repository }}/compare/${{ env.PREV_TAG }}...${{ env.VERSION }}" >> $GITHUB_ENV
@@ -62,13 +48,10 @@ jobs:
6248
6349 - name : Generate Changelog
6450 if : env.CREATE_RELEASE == 'true'
65- id : changelog
6651 run : |
67- # Make the script executable
6852 chmod +x .github/generate_changelog.sh
6953 source .github/generate_changelog.sh
70-
71- # Generate the changelog and store it in the GITHUB_ENV
54+
7255 echo "CHANGELOG<<EOF" >> $GITHUB_ENV
7356 if [ -n "${{ env.PREV_TAG }}" ]; then
7457 generate_categorized_changelog "${{ env.PREV_TAG }}" >> $GITHUB_ENV
8972 **Full Changelog**: ${{ env.URL }}
9073 draft : false
9174 prerelease : false
92- target_commitish : main # Explicitly use main branch
75+ target_commitish : main
9376 env :
9477 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments