diff --git a/.github/workflows/push_gem.yml b/.github/workflows/push_gem.yml index 55c12325a..2db5144b3 100644 --- a/.github/workflows/push_gem.yml +++ b/.github/workflows/push_gem.yml @@ -4,6 +4,12 @@ on: push: tags: - v* + workflow_dispatch: + inputs: + tag: + description: 'Tag to push to RubyGems (e.g. v4.14.0)' + required: true + type: string permissions: contents: read @@ -29,6 +35,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} persist-credentials: false - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/script/publish b/script/publish index 68d31e4fd..d37414475 100755 --- a/script/publish +++ b/script/publish @@ -71,3 +71,13 @@ gh release create "$tag" \ --title "$version" \ --notes "$changelog" \ --repo ViewComponent/view_component + +# Kick off the Push Gem workflow explicitly. GitHub Actions does not +# trigger downstream workflows for events driven by GITHUB_TOKEN — so +# the tag push above will not fire push_gem.yml on its own when this +# script runs inside the publish-release workflow. Dispatch it here so +# 'script/publish' always results in a gem being pushed to RubyGems. +gh workflow run push_gem.yml \ + --repo ViewComponent/view_component \ + --ref main \ + --field tag="$tag" || true