chore: trigger release #4
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: Test/Lint/Release | |
permissions: | |
contents: write | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-test-lint: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.10' | |
cache: poetry | |
- run: poetry install | |
- run: poetry run pytest -v signway_sdk | |
- run: poetry run flake8 | |
release: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- unit-test-lint | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' # https://github.com/actions/checkout/issues/217 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: poetry | |
- name: Tag | |
run: | | |
version=$(.github/semver.sh) | |
git config user.name github-actions | |
git config user.email [email protected] | |
poetry version $version | |
git add . | |
git commit -m "tag: v$version" | |
git tag "v$version" | |
git push | |
git push --tags | |
echo "version=$version" >> "$GITHUB_OUTPUT" | |
- name: Release | |
run: gh release create "v${{ steps.tag.outputs.version }}" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- run: poetry build | |
- run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} |