refactor: use match statements where idiomatic (#161) #191
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**.md' | |
| jobs: | |
| test: | |
| name: Test and maybe tag | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v2 | |
| - name: Set up mise | |
| uses: jdx/mise-action@v3 | |
| - name: Extract version | |
| id: extract-version | |
| run: | | |
| PACKAGE_VERSION="$(./scripts/version.sh show)" | |
| echo "::set-output name=version::$PACKAGE_VERSION" | |
| - name: Install dependencies | |
| run: poetry install --all-extras | |
| - name: Lint | |
| run: poetry run poe lint | |
| - name: Set up API server | |
| uses: opvious/api-server-action@v0.2.0 | |
| with: | |
| license-key: ${{ secrets.OPVIOUS_LICENSE_KEY }} | |
| - name: Register specifications | |
| run: ./scripts/specifications.sh register | |
| - name: Test | |
| run: poetry run pytest | |
| - name: Check if tag exists | |
| uses: mukunku/tag-exists-action@v1.1.0 | |
| id: check-version | |
| with: | |
| tag: v${{ steps.extract-version.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish | |
| if: steps.check-version.outputs.exists == 'false' | |
| run: poetry publish --build | |
| env: | |
| POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
| - name: Create tag | |
| if: steps.check-version.outputs.exists == 'false' | |
| uses: pkgdeps/git-tag-action@v2 | |
| with: | |
| git_commit_sha: ${{ github.sha }} | |
| git_tag_prefix: v | |
| github_repo: ${{ github.repository }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| version: ${{ steps.extract-version.outputs.version }} |