Redesigned CD pipeline #2
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: Release | |
on: | |
workflow_call: | |
secrets: | |
BOT_TOKEN: | |
required: true | |
PYPI_TOKEN: | |
required: true | |
jobs: | |
deploy: | |
name: Deploy | |
environment: Deployment | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install deps | |
run: | | |
python -m pip install pip --upgrade | |
python -m pip install poetry githubrelease httpx==0.18.2 autopub poetry | |
- name: Check if we should release | |
id: check_release | |
run: | | |
set +e | |
echo ::set-output name=release::$(autopub check) | |
- name: Publish | |
uses: actions/checkout@v4 | |
if: steps.check_release.outputs.release == '' | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
git remote set-url origin https://${{ github.actor }}:${{ secrets.BOT_TOKEN }}@github.com/${{ github.repository }} | |
autopub prepare | |
poetry build | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git rm --cached RELEASE.md | |
git commit -m "Release ${{ github.repository_basename }} ${{ github.event.release.name }}" | |
git push origin master --force | |
poetry publish --username=__token__ |