From b78d407ba10f95ad8ad767314abd358b02869e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elijas=20Dap=C5=A1auskas?= <4084885+Elijas@users.noreply.github.com> Date: Tue, 26 Sep 2023 02:49:47 +0300 Subject: [PATCH] feat(ci): use GitHub run_number for post-release versioning --- .github/workflows/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f953d5d..1ef680d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,11 +30,10 @@ jobs: run: poetry build - name: Publish package run: | - # Use the build number to create a pre-release or post-release version identifier - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - BUILD_NUMBER=${{ github.event.inputs.build_number }} + # Use GitHub's run_number as a post-release version identifier + if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.ref }}" == 'refs/heads/main' ]]; then POETRY_VERSION=$(poetry version | awk '{print $2}') - NEW_VERSION="${POETRY_VERSION}.post${BUILD_NUMBER}" + NEW_VERSION="${POETRY_VERSION}.post${{ github.run_number }}" poetry version "${NEW_VERSION}" fi poetry build