distribute #5
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: distribute | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- pyproject.toml | |
- setup.py | |
- setup.cfg | |
- attribute_name_validator/** | |
jobs: | |
distribute: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: install | |
run: make ci-install | |
- name: configure git | |
run: | | |
git config --global user.email "$(git --no-pager show -s --format=%ae)" && \ | |
git config --global user.name "$(git --no-pager show -s --format=%an)" | |
- name: tag version | |
run: venv/bin/daves-dev-tools git tag-version | |
- name: push tags | |
run: git push --tags || echo "Tag already exists" | |
- name: install gh | |
run: | | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | |
&& sudo apt update \ | |
&& sudo apt install gh -y | |
- name: create release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: gh release create "$(venv/bin/python setup.py --version)" || echo "Release already exists" | |
- name: Distribute to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: make distribute |