v3.0.8 #48
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
| # This workflow will upload a Python Package using Twine when a release is created | |
| # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Upload Python Package | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy-pypi: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Check versions | |
| run: | | |
| uv run python .github/pyproject_versions.py -c | |
| - name: Build package | |
| run: uv build | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} | |
| publish-to-conda: | |
| runs-on: ubuntu-24.04 | |
| needs: [ deploy-pypi ] | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Restore build | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| path: /tmp/conda-bld | |
| key: build-conda-${{ github.sha }} | |
| fail-on-cache-miss: true | |
| - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
| with: | |
| activate-environment: codecarbon | |
| miniforge-version: latest | |
| python-version: 3.12 | |
| use-mamba: true | |
| - name: Install package | |
| shell: bash -l {0} | |
| run: mamba install --channel file:///tmp/conda-bld --channel codecarbon codecarbon | |
| - name: Test conda package | |
| shell: bash -l {0} | |
| run: codecarbon --help | |
| - name: Conda upload already build package | |
| shell: bash -l {0} | |
| env: | |
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| run: | | |
| anaconda upload --user codecarbon /tmp/conda-bld/noarch/codecarbon-*.tar.bz2 |