v3.0.0a3 #80
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: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| checks: | |
| name: Run checks workflow | |
| uses: TransformerLensOrg/TransformerLens/.github/workflows/checks.yml@main | |
| secrets: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| semver-parser: | |
| name: Parse the semantic version from the release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install packaging | |
| run: pip install packaging | |
| - name: Parse semver string | |
| id: semver_parser | |
| env: | |
| RAW_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| VERSION="${RAW_TAG#v}" | |
| echo "Detected version: $VERSION" | |
| echo "::set-output name=version::$(python -c "from packaging.version import Version; print(Version('$VERSION'))")" | |
| outputs: | |
| semver: "${{ steps.semver_parser.outputs.version }}" | |
| release-python: | |
| name: Release Python package to PyPi | |
| needs: | |
| - checks | |
| - semver-parser | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| cache: 'poetry' | |
| - name: Poetry config | |
| run: poetry self add 'poethepoet[poetry_plugin]' | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Set the version | |
| run: poetry version ${{needs.semver-parser.outputs.semver}} | |
| - name: Build | |
| run: poetry build | |
| - name: Publish | |
| run: poetry publish | |
| env: | |
| POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN_PYPI }} |