diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..6d29ee9d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + push: + tags: + - "v*" + +env: + POETRY_VERSION: 1.3.2 + PYTHON_VERSION: 3.11 + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup environment. + uses: ./.github/actions/setup-micropy + with: + poetry-version: ${{ env.POETRY_VERSION }} + python-version: ${{ env.PYTHON_VERSION }} + + - name: Check Version + id: check-version + run: | + [[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT + + - name: Build + run: poetry build + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GH_PAT }} + draft: false + prerelease: steps.check-version.outputs.prerelease == 'true' + + - name: Publish + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + run: poetry publish