diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a1253a..bb04d4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,18 +18,38 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - name: Install uv uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Set up Python + run: uv python install + + - name: Install dependencies + run: uv sync --all-extras --dev - name: Python Semantic Release id: release - uses: python-semantic-release/python-semantic-release@v9.15.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global user.name "github-actions [bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + # We run versioning and publishing manually via uv to ensure it has access to the environment + uv run semantic-release -v version + uv run semantic-release -v publish + + # Set output for the next step + if [ -f ".release_version" ]; then + echo "released=true" >> $GITHUB_OUTPUT + fi - name: Publish to PyPI if: steps.release.outputs.released == 'true' run: uv publish env: - UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} # Fallback if Trusted Publishing is not set + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index a5396c4..b6eb469 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,8 @@ dev = [ [tool.semantic_release] version_toml = ["pyproject.toml:project.version"] +version_variable = ["bestbuyapi/__init__.py:__version__"] +tag_format = "{version}" build_command = "uv build" [tool.semantic_release.branches.main]