Deploy workflow #21
This file contains 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: Deploy workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
comments: | |
description: "Comments" | |
required: false | |
jobs: | |
release_changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print author | |
run: | | |
echo "Author: ${{ github.triggering_actor }}" | |
echo "Comments: ${{ github.event.inputs.comments }}" | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
- name: Draft change log | |
uses: release-drafter/release-drafter@v6 | |
id: release-drafter | |
with: | |
commitish: ${{ steps.extract_branch.outputs.branch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set new release version | |
env: | |
RD_RELEASE: ${{ steps.release-drafter.outputs.name }} | |
run: | | |
if [ ! -z "$RD_RELEASE" ]; then | |
echo "NEW_RELEASE=$RD_RELEASE" >> $GITHUB_ENV | |
else | |
echo "NEW_RELEASE=0.1.0" >> $GITHUB_ENV | |
fi | |
- name: Publish change log | |
uses: release-drafter/release-drafter@v6 | |
with: | |
commitish: ${{ steps.extract_branch.outputs.branch }} | |
publish: true | |
name: ${{ env.NEW_RELEASE }} | |
tag: "v${{ env.NEW_RELEASE }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [release_changelog] | |
steps: | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
- name: Fetch tags | |
run: | | |
git fetch --tags | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install Poetry Dynamic Version | |
run: | | |
poetry self add "poetry-dynamic-versioning[plugin]" | |
- name: Build and publish | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
poetry publish --build |