From c2c164a268ba607d94b50fa1f0f4c66e15ceadcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Ba=CC=88chler?= Date: Mon, 17 Nov 2025 10:21:53 +0100 Subject: [PATCH] ci: Update Publish Workflow to actually run after release --- .github/workflows/publish.yml | 30 ++++++++++++++++++++++++++---- .github/workflows/release.yml | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 94de0d6..29b1b22 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,14 @@ name: Publish Package on: - push: - tags: - - 'v*' + workflow_run: + workflows: + - "Manual release" + types: + - completed + # optionally also respond to manual release events (fallback) + release: + types: [published] permissions: contents: read @@ -11,11 +16,28 @@ permissions: jobs: publish: + # Only run when the release workflow completed successfully and produced a tag starting with "v" + if: >- + ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || + (github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v')) }} runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout repository (fetch all tags) uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Resolve tag to publish + id: tag + run: | + # Prefer the release tag if available; otherwise try to read from workflow_run head_branch/ref + if [ "${{ github.event_name }}" = "release" ]; then + echo "tag=${{ github.event.release.tag_name }}" >>"$GITHUB_OUTPUT" + else + # for a workflow_run we can try to use the ref from the completed run (head_branch/head_sha) + # adjust logic here to extract the correct tag if your release.yml sets outputs or artifacts + echo "tag=${GITHUB_REF#refs/tags/}" >>"$GITHUB_OUTPUT" || true + fi - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc3f4d4..2164ae0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Manual release — commit-and-tag-version +name: Manual release on: workflow_dispatch: