From 1c1f7def552734b6fc785f54e103d1d2d04f870f Mon Sep 17 00:00:00 2001 From: Braden Mars Date: Sun, 29 Jan 2023 04:37:37 -0600 Subject: [PATCH] ci: add release workflow Signed-off-by: Braden Mars --- .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/release.yml 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