|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + |
| 8 | +jobs: |
| 9 | + release-please: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + env: |
| 12 | + PACKAGE_NAME: "conjecture" |
| 13 | + steps: |
| 14 | + - name: release please |
| 15 | + uses: google-github-actions/release-please-action@v3 |
| 16 | + id: release |
| 17 | + with: |
| 18 | + release-type: python |
| 19 | + package-name: ${{ env.PACKAGE_NAME }} |
| 20 | + |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + if: ${{ steps.release.outputs.release_created }} |
| 23 | + |
| 24 | + - name: set python version |
| 25 | + if: ${{ steps.release.outputs.release_created }} |
| 26 | + uses: actions/setup-python@v1 |
| 27 | + with: |
| 28 | + python-version: "3.10" |
| 29 | + |
| 30 | + - name: install poetry |
| 31 | + if: ${{ steps.release.outputs.release_created }} |
| 32 | + run: | |
| 33 | + curl -sSL https://install.python-poetry.org | python - --preview |
| 34 | + |
| 35 | + - name: Update PATH |
| 36 | + if: ${{ steps.release.outputs.release_created }} |
| 37 | + run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 38 | + |
| 39 | + - name: configure poetry |
| 40 | + if: ${{ steps.release.outputs.release_created }} |
| 41 | + run: poetry config virtualenvs.in-project true |
| 42 | + |
| 43 | + - name: set up python cache |
| 44 | + if: ${{ steps.release.outputs.release_created }} |
| 45 | + uses: actions/cache@v2 |
| 46 | + id: python-cache |
| 47 | + with: |
| 48 | + path: .venv |
| 49 | + key: venv-${{ hashFiles('**/poetry.lock') }} |
| 50 | + |
| 51 | + - name: ensure cache is healthy |
| 52 | + if: ${{ steps.python-cache.outputs.cache-hit == 'true' && steps.release.outputs.release_created }} |
| 53 | + run: timeout 10s poetry run pip --version || rm -rf .venv |
| 54 | + |
| 55 | + - name: install python dependencies |
| 56 | + if: ${{ steps.python-cache.outputs.cache-hit != 'true' && steps.release.outputs.release_created }} |
| 57 | + run: poetry install |
| 58 | + |
| 59 | + - name: build release |
| 60 | + if: ${{ steps.release.outputs.release_created }} |
| 61 | + run: poetry build |
| 62 | + |
| 63 | + - name: upload assets |
| 64 | + uses: softprops/action-gh-release@v1 |
| 65 | + if: ${{ steps.release.outputs.release_created }} |
| 66 | + with: |
| 67 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 68 | + files: dist/* |
| 69 | + |
| 70 | + - name: publish release |
| 71 | + if: ${{ steps.release.outputs.release_created }} |
| 72 | + run: poetry publish |
| 73 | + env: |
| 74 | + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_AUTH_TOKEN }} |
0 commit comments