Make a release #55
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: Make a release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_bump: | |
| description: 'Overide the automatic version bump (default: automatic)' | |
| required: true | |
| default: 'minor' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python 3.12 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.12 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: 1.8.1 | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Setup cache for dependencies | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install npm dependencies | |
| run: npm install | |
| - name: Run npm check | |
| run: npm run check | |
| - name: Check code formatting with black | |
| run: poetry run black --check . | |
| - name: Tests and release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VERSION_BUMP: ${{ github.event.inputs.version_bump }} | |
| PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "action@github.com" | |
| # print the version bump | |
| echo "Version bump: $VERSION_BUMP" | |
| if [ "$VERSION_BUMP" = "automatic" ]; then | |
| poetry run semantic-release -v version | |
| fi | |
| if [ "$VERSION_BUMP" = "patch" ]; then | |
| poetry run semantic-release -v version --patch | |
| fi | |
| if [ "$VERSION_BUMP" = "minor" ]; then | |
| poetry run semantic-release -v version --minor | |
| fi | |
| if [ "$VERSION_BUMP" = "major" ]; then | |
| poetry run semantic-release -v version --major | |
| fi | |
| poetry run semantic-release -v publish | |
| poetry publish --username __token__ --password $PYPI_TOKEN | |