Skip to content

Commit a7c846d

Browse files
joelhawksleyCopilot
andcommitted
Trigger push_gem workflow after tagging, and allow manual dispatch
Publishing 4.14.0 tagged v4.14.0 and created the GitHub release, but push_gem.yml did not run and no gem was pushed to RubyGems. Root cause: GitHub Actions does not trigger downstream workflows for events driven by GITHUB_TOKEN. script/publish now runs inside the publish-release workflow, which uses GITHUB_TOKEN for its checkout — so the 'git push origin v4.14.0' from that job does not fire the 'push: tags: v*' event on push_gem.yml. Previous releases were tagged by a maintainer running script/publish locally with a PAT, which is why push_gem always fired for them. Two changes: - Add a workflow_dispatch trigger to push_gem.yml with a required 'tag' input, and check that tag out. This lets a maintainer manually push the gem for a specific tag (needed right now to publish v4.14.0 to RubyGems). - At the end of script/publish, dispatch push_gem.yml with the freshly created tag. || true so any dispatch failure never masks a successful release. This makes future releases push the gem automatically even when script/publish runs from Actions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 217f0a0d-a9f2-4607-9643-5fcb3e34f20f
1 parent b7094df commit a7c846d

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎.github/workflows/push_gem.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- v*
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to push to RubyGems (e.g. v4.14.0)'
11+
required: true
12+
type: string
713

814
permissions:
915
contents: read
@@ -29,6 +35,7 @@ jobs:
2935

3036
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
3137
with:
38+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
3239
persist-credentials: false
3340
- name: Set up Ruby
3441
uses: ruby/setup-ruby@v1

‎script/publish‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ gh release create "$tag" \
7171
--title "$version" \
7272
--notes "$changelog" \
7373
--repo ViewComponent/view_component
74+
75+
# Kick off the Push Gem workflow explicitly. GitHub Actions does not
76+
# trigger downstream workflows for events driven by GITHUB_TOKEN — so
77+
# the tag push above will not fire push_gem.yml on its own when this
78+
# script runs inside the publish-release workflow. Dispatch it here so
79+
# 'script/publish' always results in a gem being pushed to RubyGems.
80+
gh workflow run push_gem.yml \
81+
--repo ViewComponent/view_component \
82+
--ref main \
83+
--field tag="$tag" || true

0 commit comments

Comments
 (0)