Support dynamic versions #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - main | |
| jobs: | |
| update-version-minor: | |
| name: Bump Version and Commit | |
| if: github.ref == 'refs/heads/dev' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Bump Version | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| VERSION=$(uvx hatch version) | |
| hatch version minor | |
| NEW_VERSION=$(uvx hatch version) | |
| git add src/cloud_autopkg_runner/__about__.py | |
| git commit -m "Bump version: ${VERSION} → ${NEW_VERSION}" | |
| git tag ${VERSION} | |
| git push | |
| git push --tags | |
| publish-to-testpypi: | |
| name: Publish to TestPyPI | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: TestPyPi | |
| url: https://test.pypi.org/p/cloud-autopkg-runner | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Build | |
| run: uv build | |
| - name: Publish | |
| run: uv publish --index testpypi --trusted-publishing always | |
| install-library-from-testpypi: | |
| name: Install from TestPyPI | |
| needs: [publish-to-testpypi] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Install | |
| run: uv run --with cloud-autopkg-runner --extra-index-url https://test.pypi.org/simple/ --index-strategy unsafe-best-match --no-project -- python -c "import cloud_autopkg_runner" | |
| update-version-dev: | |
| name: Bump Version | |
| needs: [install-library-from-testpypi] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Bump Version | |
| run: uvx hatch version dev | |
| update-version-release: | |
| name: Bump Version and Commit | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Bump Version | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| VERSION=$(uvx hatch version) | |
| hatch version release | |
| NEW_VERSION=$(uvx hatch version) | |
| git add src/cloud_autopkg_runner/__about__.py | |
| git commit -m "Bump version: ${VERSION} → ${NEW_VERSION}" | |
| git tag ${VERSION} | |
| git push | |
| git push --tags | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| if: github.ref == 'refs/heads/main' | |
| needs: [update-version-release] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: PyPi | |
| url: https://pypi.org/p/cloud-autopkg-runner | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Build | |
| run: uv build | |
| - name: Publish | |
| run: uv publish --trusted-publishing always | |
| install-library-from-pypi: | |
| name: Install from PyPI | |
| needs: [publish-to-pypi] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Install | |
| run: uv run --with cloud-autopkg-runner --no-project -- python -c "import cloud_autopkg_runner" |