Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
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
id-token: write

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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Manual release — commit-and-tag-version
name: Manual release
on:
workflow_dispatch:

Expand Down