File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name: Local Binding Publish
2+
3+ on:
4+ workflow_dispatch:
5+ inputs:
6+ version_type:
7+ description: Version Type
8+ required: true
9+ default: patch
10+ type: choice
11+ options:
12+ - patch
13+ - minor
14+ - major
15+ - prerelease
16+
17+ permissions:
18+ contents: read
19+
20+ jobs:
21+ publish:
22+ if: github.ref == 'refs/heads/master'
23+ runs-on: ubuntu-latest
24+ permissions:
25+ contents: write
26+ id-token: write
27+ env:
28+ VERSION_TYPE: ${{ inputs.version_type }}
29+ steps:
30+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+ with:
32+ fetch-depth: 0
33+
34+ # No registry-url: setup-node would write an .npmrc token line that shadows OIDC.
35+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
36+ with:
37+ node-version: 24
38+
39+ - run: npm install -g npm@11.21.0
40+
41+ - name: Upgrade version
42+ run: |
43+ git config user.name "github-actions[bot]"
44+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
45+ npm version "$VERSION_TYPE" --preid tp
46+
47+ - name: Publish
48+ run: npm publish --access public --tag "$([ "$VERSION_TYPE" = prerelease ] && echo next || echo latest)"
49+
50+ - name: Push tag
51+ if: inputs.version_type == 'prerelease'
52+ run: git push origin "$(git describe --exact-match)"
53+
54+ - name: Push tag and version bump branch
55+ if: inputs.version_type != 'prerelease'
56+ run: |
57+ branch="release-$(date +%s)"
58+ git push --follow-tags origin "HEAD:refs/heads/$branch"
59+ echo "Open the version bump PR: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/compare/master...$branch?expand=1" | tee -a "$GITHUB_STEP_SUMMARY"
You can’t perform that action at this time.
0 commit comments