Skip to content

Release

Release #68

Workflow file for this run

---
name: Release
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
environment: deployment
name: Build, publish, and release
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache pip repository
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Determine version and create changelog
id: bumper
uses: tomerfi/version-bumper-action@1.2.2
- name: Set new project version
uses: ciiiii/toml-editor@1.0.0
with:
file: pyproject.toml
key: tool.poetry.version
value: ${{ steps.bumper.outputs.new_version }}
- name: Commit, tag, and push
# yamllint disable rule:line-length
# editorconfig-checker-disable
run: |
git add pyproject.toml
git commit -m "build: bump version to ${{ steps.bumper.outputs.new_version }} [skip ci]"
git push
git tag ${{ steps.bumper.outputs.new_version }} -m "${{ steps.bumper.outputs.new_version }}"
git push origin ${{ steps.bumper.outputs.new_version }}
# yamllint enable rule:line-length
# editorconfig-checker-enable
- name: Verify documentation site build
run: |
make install-docs-only-deps
make docs-build
- name: Publish build to PyPi
run: PYPI_TOKEN="${{ secrets.PYPI_TOKEN }}" make publish
- name: Set development project version
uses: ciiiii/toml-editor@1.0.0
with:
file: pyproject.toml
key: tool.poetry.version
value: ${{ steps.bumper.outputs.next_dev_iteration }}
- name: Commit and push
# yamllint disable rule:line-length
run: |
git add pyproject.toml
git commit -m "build: bump version to ${{ steps.bumper.outputs.next_dev_iteration }} [skip ci]"
git push
# yamllint enable rule:line-length
- name: Create a release
id: gh_release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.RELEASE_PAT }}
script: |
const repo_name = context.payload.repository.full_name
const response = await github.request('POST /repos/' + repo_name + '/releases', {
tag_name: '${{ steps.bumper.outputs.new_version }}',
generate_release_notes: true
})
core.setOutput('html_url', response.data.html_url)