Skip to content

CD

CD #42

Workflow file for this run

name: CD
on:
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Set Version
run: echo "VERSION=$(awk -F' = ' '/^\[tool.poetry\]$/{f=1} f&&/^version = /{gsub(/"/, "", $2); print $2; exit}' pyproject.toml)" >> $GITHUB_ENV
- name: Create tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/V${{ env.VERSION }}',
sha: context.sha
})
- name: Create a Release
uses: elgohr/Github-Release-Action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: Release ${{ env.VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
- name: Publish to pypi
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build