From 304d7e78985cbe25ae04fe8f2bce26651eb7d851 Mon Sep 17 00:00:00 2001 From: Raphael Krupinski Date: Sat, 26 Oct 2024 23:53:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Fix=20GHA=20release=20workflow.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/draft-release.yaml | 39 ---------------------------- .github/workflows/test.yaml | 36 +++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/draft-release.yaml diff --git a/.github/workflows/draft-release.yaml b/.github/workflows/draft-release.yaml deleted file mode 100644 index 3c998af..0000000 --- a/.github/workflows/draft-release.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Draft Release - -on: - workflow_run: - workflows: ["Test"] - types: - - completed - branches: - - main - workflow_dispatch: {} - -jobs: - release-draft: - permissions: - contents: write - runs-on: ubuntu-latest - if: > - github.event.workflow_run.conclusion == 'success' && - startsWith(github.event.workflow_run.head_commit.message, 'refs/tags/') - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - name: Install uv - uses: astral-sh/setup-uv@v3 - with: - enable-cache: true - - name: Build - run: uv build - - - name: Create release - env: - tag: ${{ github.ref_name }} - run: | - gh release create -d "$tag" \ - --repo="$GITHUB_REPOSITORY" \ - --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ - --generate-notes \ - --latest \ - dist/*.tar.gz dist/*.whl diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bc10d70..9ff74b2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,8 +41,7 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.release.tag_name }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -61,3 +60,36 @@ jobs: - name: Run pytest run: uv run pytest + + release-draft: + name: Draft Release + needs: tests + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + + permissions: + contents: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + + - name: Build Project + run: uv build + + - name: Create Draft Release + env: + TAG_NAME: ${{ github.ref_name }} + GH_TOKEN: ${{ github.token }} + run: | + gh release create "$TAG_NAME" \ + --repo "$GITHUB_REPOSITORY" \ + --title "${GITHUB_REPOSITORY#*/} ${TAG_NAME#v}" \ + --generate-notes \ + --draft \ + dist/*.tar.gz dist/*.whl