Skip to content

Build and publish a release #101

Build and publish a release

Build and publish a release #101

Workflow file for this run

name: Build and publish a release
on:
release:
types: [prereleased, released]
jobs:
test:
name: Run checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: python3 .github/scripts/poetry_install.py --version 1.8.2
- name: Install dependencies
run: poetry install
- name: Run formatters in check mode
run: poetry run poe checks_codestyle
- name: Run unit tests
run: poetry run poe tests_unit
build:
needs: [test]
name: Build the release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: python3 .github/scripts/poetry_install.py --version 1.8.2
- name: Get git release tag
run: echo "::set-output name=git-release-tag::goth $(git describe --tags)"
id: git_describe
- name: Get package version
run: echo "::set-output name=poetry-version::$(poetry version)"
id: poetry_version
- name: Build the release
run: poetry build
- name: Store the built package
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
test_publish:
needs: [build]
name: Publish the release to test.pypi
runs-on: ubuntu-latest
if: ${{ github.event.action == 'prereleased' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: python3 .github/scripts/poetry_install.py --version 1.8.2
- name: Retrieve the built package
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to pypi
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi -u __token__ -p ${{ secrets.TESTPYPI_TOKEN }}
publish:
needs: [build]
name: Publish the release
runs-on: ubuntu-latest
if: ${{ github.event.action == 'released' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: python3 .github/scripts/poetry_install.py --version 1.8.2
- name: Retrieve the built package
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to pypi
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}