|
| 1 | +name: "Bump version and create release" |
| 2 | +description: "Bumps version, creates a tag, and publishes a release." |
| 3 | + |
| 4 | +inputs: |
| 5 | + github_token: |
| 6 | + description: "GitHub token for authentication" |
| 7 | + required: true |
| 8 | + |
| 9 | +outputs: |
| 10 | + tag: |
| 11 | + description: 'A new tag' |
| 12 | + value: ${{ steps.tag_version.outputs.new_tag }} |
| 13 | + |
| 14 | +runs: |
| 15 | + using: "composite" |
| 16 | + steps: |
| 17 | + # ----------------------------------------------------------------------------- |
| 18 | + # Step 2: Bump version and tag |
| 19 | + # ----------------------------------------------------------------------------- |
| 20 | + - name: Bump version and tag |
| 21 | + id: tag_version |
| 22 | + uses: mathieudutour/[email protected] |
| 23 | + with: |
| 24 | + github_token: ${{ inputs.github_token }} |
| 25 | + |
| 26 | + # ----------------------------------------------------------------------------- |
| 27 | + # Step 3: Install dependencies (hatch for packaging) |
| 28 | + # ----------------------------------------------------------------------------- |
| 29 | + - name: Install dependencies |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade hatch |
| 33 | +
|
| 34 | + # ----------------------------------------------------------------------------- |
| 35 | + # Step 4: Update version in pyproject.toml |
| 36 | + # ----------------------------------------------------------------------------- |
| 37 | + - name: Update version in pyproject.toml |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + echo "Updating version to ${{ steps.tag_version.outputs.new_tag }}" |
| 41 | + sed -i "s/0.0.0/${{ steps.tag_version.outputs.new_tag }}/" pyproject.toml |
| 42 | +
|
| 43 | + # ----------------------------------------------------------------------------- |
| 44 | + # Step 5: Build the package |
| 45 | + # ----------------------------------------------------------------------------- |
| 46 | + - name: Build package |
| 47 | + shell: bash |
| 48 | + run: | |
| 49 | + hatch build |
| 50 | +
|
| 51 | + # ----------------------------------------------------------------------------- |
| 52 | + # Step 6: Upload build artifacts |
| 53 | + # ----------------------------------------------------------------------------- |
| 54 | + - name: Upload distribution artifacts |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: dist |
| 58 | + path: dist/ |
| 59 | + retention-days: 1 |
| 60 | + |
| 61 | + # ----------------------------------------------------------------------------- |
| 62 | + # Step 7: Create GitHub release |
| 63 | + # ----------------------------------------------------------------------------- |
| 64 | + - name: Create GitHub release with artifacts |
| 65 | + uses: softprops/action-gh-release@v2 |
| 66 | + with: |
| 67 | + tag_name: ${{ steps.tag_version.outputs.new_tag }} |
| 68 | + generate_release_notes: true |
| 69 | + files: dist/* |
| 70 | + |
| 71 | + - name: Debug Output Tag |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + echo "DEBUG: ${{ steps.tag_version.outputs.new_tag }}" |
0 commit comments