Skip to content

Commit d0a170f

Browse files
Dispatch the GitHub Packages mirror from the release workflow
1 parent acb00b2 commit d0a170f

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/github-packages.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: GitHub Packages
22

33
# Mirrors published releases to GitHub Packages (npm.pkg.github.com) so the
44
# package is listed on the organization packages page. The primary registry
5-
# remains npmjs.org; this publication is a courtesy mirror. Runs automatically
6-
# when a GitHub release is published and can be triggered manually for an
7-
# existing tag.
5+
# remains npmjs.org; this publication is a courtesy mirror. Dispatched by the
6+
# Release workflow after a successful release (a `release: published` trigger
7+
# would never fire, since releases are created with GITHUB_TOKEN and GitHub
8+
# suppresses workflow triggers from such events) and can be triggered manually
9+
# for an existing tag.
810
on:
9-
release:
10-
types: [published]
1111
workflow_dispatch:
1212
inputs:
1313
tag:
@@ -27,7 +27,7 @@ jobs:
2727
# The raw value is passed through the environment (never interpolated
2828
# into the shell) and strictly validated before being used as a ref.
2929
env:
30-
TAG_INPUT: ${{ inputs.tag || github.event.release.tag_name }}
30+
TAG_INPUT: ${{ inputs.tag }}
3131
run: |
3232
set -euo pipefail
3333
if ! printf '%s' "$TAG_INPUT" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$'; then

.github/workflows/release.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
type: string
2020

2121
permissions:
22+
actions: write # dispatch the GitHub Packages mirror workflow
2223
contents: write
2324
id-token: write # npm trusted publishing and provenance
2425

@@ -138,3 +139,8 @@ jobs:
138139
--notes-file release-notes.md \
139140
$prerelease
140141
echo "Released $TAG: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG"
142+
143+
- name: Mirror to GitHub Packages
144+
env:
145+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146+
run: gh workflow run github-packages.yaml -f "tag=$TAG"

0 commit comments

Comments
 (0)