Skip to content

Commit

Permalink
tag action
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Jan 29, 2025
1 parent 665f66d commit a126ae6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 38 deletions.
32 changes: 2 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ name: Bump version and publish

on:
workflow_dispatch:
workflow_run:
workflows: [ "CI" ]
types: [ completed ]


jobs:
tag:
permissions:
contents: write

if: >
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main')
runs-on: ubuntu-latest

steps:
Expand All @@ -26,25 +19,4 @@ jobs:
uses: ./actions/uv/tag
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

publish:
needs: tag
runs-on: ubuntu-latest
environment: release

permissions:
contents: read
# This permission is required for trusted publishing.
id-token: write

steps:
- name: Checkout [${{ github.repository }}]
uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
build_package: 'false'
23 changes: 15 additions & 8 deletions actions/uv/tag/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: 'Python version to use for the build'
required: false
default: '3.12'
build_package:
description: 'Whether to build and include package artifacts in the release'
required: false
default: 'true'

runs:
using: "composite"
Expand All @@ -32,6 +36,7 @@ runs:
# Step 3: Set up Python environment
# -----------------------------------------------------------------------------
- name: Set up Python ${{ inputs.python_version }}
if: inputs.build_package == 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
Expand All @@ -41,6 +46,7 @@ runs:
# Step 4: Install dependencies (hatch for packaging)
# -----------------------------------------------------------------------------
- name: Install dependencies
if: inputs.build_package == 'true'
shell: bash
run: |
python -m pip install --upgrade pip hatch
Expand All @@ -49,6 +55,7 @@ runs:
# Step 5: Update version in pyproject.toml
# -----------------------------------------------------------------------------
- name: Update version in pyproject.toml
if: inputs.build_package == 'true'
shell: bash
run: |
echo "Updating version to ${{ steps.tag_version.outputs.new_tag }}"
Expand All @@ -58,6 +65,7 @@ runs:
# Step 6: Build the package
# -----------------------------------------------------------------------------
- name: Build package
if: inputs.build_package == 'true'
shell: bash
run: |
echo "Building package for version: ${{ steps.tag_version.outputs.new_tag }}"
Expand All @@ -66,7 +74,8 @@ runs:
# -----------------------------------------------------------------------------
# Step 7: Create GitHub release
# -----------------------------------------------------------------------------
- name: Create GitHub release
- name: Create GitHub release with artifacts
if: inputs.build_package == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
Expand All @@ -75,11 +84,9 @@ runs:
dist/*.whl
dist/*.tar.gz
# -----------------------------------------------------------------------------
# Step 8: Upload build artifacts
# -----------------------------------------------------------------------------
- name: Upload build artifacts
uses: actions/upload-artifact@v4
- name: Create GitHub release without artifacts
if: inputs.build_package != 'true'
uses: softprops/action-gh-release@v2
with:
name: dist
path: dist
tag_name: ${{ steps.tag_version.outputs.new_tag }}
generate_release_notes: true

0 comments on commit a126ae6

Please sign in to comment.