From 96a75957f49a2994762e7f687f00eb27263f99b8 Mon Sep 17 00:00:00 2001 From: Gregory Kohler Date: Tue, 2 Jan 2024 16:58:24 -0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=F0=9F=93=A6=20workflow=20for=20publishing=20new=20releases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now this requires manually bumping poetry and creating a git release but I added a couple of guardrails so that we ensure we only publish when the poetry package version matches the github release reference. Future iteration will move the version bumping and release cutting to the workflow. --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 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 0000000..61cee25 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +on: + workflow_dispatch: +jobs: + publish-release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Ensure valid tag reference + if: ${{ github.ref_type != 'tag' }} || ${{ !startsWith(github.ref_name, 'v') }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('you can only run the publish workflow from a release tag (vX.Y.Z)') + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version-file: .python-version + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: "1.6.1" + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: output library version + id: output-version + # prefix with v to match tag convention + run: poetry version -s | awk '{ print "version=v" $1 }' >> $GITHUB_OUTPUT + - name: check library version + if: ${{ steps.output-version.outputs.version }} != ${{ github.ref }} + id: check-version + uses: actions/github-script@v7 + with: + script: | + core.setFailed('library version does not match the github tag') + - name: Build release + id: build-release + run: poetry build + - name: Publish version to PyPI + id: publish-release + run: poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} + From dda3fc1c67c7d38adab0134f9b8cbc84d7bcc5aa Mon Sep 17 00:00:00 2001 From: Gregory Kohler Date: Wed, 3 Jan 2024 11:27:09 -0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20bump=20verison=20to?= =?UTF-8?q?=200.1.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit want something to test with when this merges --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 65b209d..cfdb03c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ionic-langchain" -version = "0.1.2" +version = "0.1.3" description = "" authors = ["Owen Sims "] readme = "README.md" From 49cc39f1aad62e3bfa37dad07d4ef7e608679323 Mon Sep 17 00:00:00 2001 From: Gregory Kohler Date: Wed, 3 Jan 2024 12:02:23 -0800 Subject: [PATCH 3/3] set workflow up for iterative testing * dry run for publishing * warn instead of fail if tag checks fail --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61cee25..baff34a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: uses: actions/github-script@v7 with: script: | - core.setFailed('you can only run the publish workflow from a release tag (vX.Y.Z)') + core.notice('you can only run the publish workflow from a release tag (vX.Y.Z)') - name: Checkout repository uses: actions/checkout@v4 with: @@ -37,11 +37,11 @@ jobs: uses: actions/github-script@v7 with: script: | - core.setFailed('library version does not match the github tag') + core.notice('library version does not match the github tag') - name: Build release id: build-release run: poetry build - name: Publish version to PyPI id: publish-release - run: poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} + run: poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --dry-run