diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4936b1a..91052b3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,13 +3,10 @@ name: Build & Deploy to PyPI on: workflow_dispatch: inputs: - environment: - description: Deployment environment - required: true - type: choice - options: - - test - - production + note: + description: 'This workflow publishes to TestPyPI only. For production, create a GitHub Release.' + required: false + default: "" release: types: [published] @@ -51,36 +48,19 @@ jobs: echo "Tag version: $TAG_VERSION" uv version $TAG_VERSION - - name: Generate HTML documentation ๐Ÿ“š - if: github.event_name == 'release' || inputs.environment == 'production' - run: | - uv sync --all-groups --frozen - uv pip install -e . - uv run pdoc --html -f -o ./docs keboola.component - mv ./docs/keboola/component/* docs - rm -r ./docs/keboola - - name: Build package ๐Ÿ“ฆ run: | uv build - - name: Publish to PyPI ๐Ÿš€ + - name: Publish to TestPyPI ๐Ÿงช env: - UV_PUBLISH_TOKEN: ${{ inputs.environment == 'test' && secrets.UV_PUBLISH_TOKEN_TEST_PYPI || secrets.UV_PUBLISH_TOKEN }} + UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN_TEST_PYPI }} run: | - uv publish ${{ inputs.environment == 'test' && '--index testpypi' || '' }} + uv publish --index testpypi - - name: Commit documentation ๐Ÿ“ - if: github.event_name == 'release' || inputs.environment == 'production' + - name: Publish to PyPI ๐Ÿš€ + if: github.event_name == 'release' + env: + UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }} run: | - TAG_VERSION=${GITHUB_REF#refs/tags/} - - # Checkout main before docs commit to avoid detached HEAD push failure - git fetch origin main - git checkout main - - git config --global user.name 'KCF' - git config --global user.email 'kcf@users.noreply.github.com' - git add docs - git commit -m "docs: update for release $TAG_VERSION ๐Ÿ“š" || echo "No changes to commit" - git push origin main + uv publish diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml new file mode 100644 index 0000000..cb7dbac --- /dev/null +++ b/.github/workflows/generate-docs.yml @@ -0,0 +1,38 @@ +name: Generate Documentation + +on: + workflow_dispatch: + +jobs: + generate-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›’ + uses: actions/checkout@v4 + + - name: Install uv ๐Ÿ’œ + uses: astral-sh/setup-uv@v6 + + - name: Set up Python ๐Ÿ + uses: actions/setup-python@v4 + with: + python-version: "3.13" + + - name: Install dependencies ๐Ÿ“ฆ + run: | + uv sync --all-groups --frozen + + - name: Generate HTML documentation ๐Ÿ“š + run: | + uv pip install -e . + uv run pdoc --html -f -o ./docs keboola.component + mv ./docs/keboola/component/* docs + rm -r ./docs/keboola + + - name: Commit documentation ๐Ÿ“ + run: | + git config --global user.name 'KCF' + git config --global user.email 'kcf@users.noreply.github.com' + git add docs + git commit -m "docs: update documentation ๐Ÿ“š" || echo "No changes to commit" + git push