[pre-commit.ci] pre-commit autoupdate (#765) #123
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: Deployment | |
on: | |
push: | |
branches: [main] | |
tags: [v*] | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: Reason for the workflow dispatch. Only "release" is valid. | |
required: true | |
default: release | |
jobs: | |
deploy: | |
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.reason == 'release') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install hatch | |
run: pip install hatch | |
# this will fail if the last commit is not tagged | |
- name: Build project for distribution | |
run: hatch build | |
- name: Publish on PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true | |
verbose: true | |
sync-branches: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract branch name | |
id: vars | |
run: | | |
echo ::set-output name=branch::${GITHUB_REF#refs/*/} | |
- name: Merge release into main | |
uses: everlytic/[email protected] | |
with: | |
github_token: ${{ secrets.RELEASE_DISPATCH_TOKEN }} | |
target_branch: main | |
commit_message_template: ${{ format('[auto][ci skip] Merge branch ''{0}'' into main', steps.vars.outputs.branch) }} |