Skip to content

Commit 5c8002f

Browse files
authored
chore(ci): dispatch npm release explicitly + allow manual dispatching with any release (#69)
## Description Fixes the npm publishing process ## Type - [x] Bug fix - [ ] Feature - [ ] Breaking change - [ ] Documentation - [ ] Chore ## Package - [x] `@dotns/cli` - [ ] Root/monorepo - [ ] Documentation ## Related Issues ## Fixes Explicit workflow trigger after release + manual dispatch with custom version ## Checklist ### Code - [ ] Follows project style - [ ] `bun run lint` passes - [ ] `bun run format` passes - [ ] `bun run typecheck` passes ### Documentation - [ ] README updated if needed - [ ] Types updated if needed ### Breaking Changes - [x] No breaking changes - [ ] Breaking changes documented below
1 parent 7bec161 commit 5c8002f

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/npm-release.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
name: NPM Release
22

33
on:
4-
release:
5-
types: [released]
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Release tag (e.g. v0.5.2)"
8+
required: true
9+
type: string
610

711
jobs:
812
publish:
913
runs-on: ubuntu-latest
1014
steps:
15+
# When dispatched automatically from release.yml, the release assets
16+
# may not be available yet (GitHub processes uploads asynchronously).
17+
# Retry up to 5 times with 15s delay to handle this race condition.
1118
- name: Download CLI tarball from release
1219
env:
1320
GH_TOKEN: ${{ github.token }}
1421
run: |
1522
mkdir -p packs
16-
gh release download "${{ github.event.release.tag_name }}" \
17-
--pattern "*.tgz" \
18-
--dir packs \
19-
--repo "${{ github.repository }}"
23+
for i in 1 2 3 4 5; do
24+
gh release download "${{ inputs.tag }}" \
25+
--pattern "*.tgz" \
26+
--dir packs \
27+
--repo "${{ github.repository }}" && break
28+
echo "Attempt $i failed, retrying in 15s..."
29+
sleep 15
30+
done
2031
ls -ltr packs
2132
2233
- name: Upload packages artifact

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- ".github/workflows/release.yml"
1313

1414
permissions:
15+
actions: write
1516
contents: write
1617
pull-requests: write
1718

@@ -413,6 +414,12 @@ jobs:
413414
generate_release_notes: true
414415
prerelease: ${{ needs.build.outputs.prerelease == 'true' }}
415416

417+
- name: Trigger NPM Release
418+
if: needs.build.outputs.prerelease != 'true'
419+
env:
420+
GH_TOKEN: ${{ github.token }}
421+
run: gh workflow run npm-release.yml --ref main -f "tag=${{ needs.build.outputs.tag }}"
422+
416423
deploy-production:
417424
name: Deploy Production
418425
if: github.event_name == 'push' && !contains(github.ref_name, '-')

0 commit comments

Comments
 (0)