Skip to content

Commit 6928481

Browse files
feat: add prviate rc publish GHA (#104)
1 parent f6758f9 commit 6928481

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish RC (Manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
rc_suffix:
7+
description: 'RC suffix (e.g., "test1" for version 2.4.3-rc.test1). Leave empty to use git SHA.'
8+
required: false
9+
default: ''
10+
11+
jobs:
12+
publish-rc:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: '16.x'
24+
registry-url: 'https://npm.pkg.github.com'
25+
26+
- name: Get Node.js version
27+
id: node-version
28+
run: |
29+
echo "version=$(node --version)" >> $GITHUB_OUTPUT
30+
31+
- name: Cache node_modules
32+
uses: actions/cache@v4
33+
id: cache-node-modules
34+
with:
35+
path: node_modules
36+
key: v1-node-${{ steps.node-version.outputs.version }}-modules-${{ hashFiles('package-lock.json') }}
37+
38+
- name: Install dependencies
39+
run: npm install
40+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.ENVOYBOT_PERSONAL_ACCESS_TOKEN }}
43+
44+
- name: Generate RC version
45+
id: rc-version
46+
run: |
47+
BASE_VERSION=$(node -p "require('./package.json').version")
48+
PACKAGE_NAME=$(node -p "require('./package.json').name")
49+
if [ -z "${{ github.event.inputs.rc_suffix }}" ]; then
50+
SHORT_SHA=$(git rev-parse --short HEAD)
51+
RC_SUFFIX="${SHORT_SHA}"
52+
else
53+
RC_SUFFIX="${{ github.event.inputs.rc_suffix }}"
54+
fi
55+
RC_VERSION="${BASE_VERSION}-rc.${RC_SUFFIX}"
56+
echo "version=${RC_VERSION}" >> $GITHUB_OUTPUT
57+
echo "📦 Publishing: ${PACKAGE_NAME}@${RC_VERSION}"
58+
59+
- name: Update package.json version
60+
run: npm version ${{ steps.rc-version.outputs.version }} --no-git-tag-version
61+
62+
- name: Compile TypeScript
63+
run: npm run compile
64+
65+
- name: Publish to GitHub Packages (private)
66+
run: npm publish --tag rc
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Summary
71+
run: |
72+
echo "✅ Successfully published RC version: ${{ steps.rc-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
73+
echo "" >> $GITHUB_STEP_SUMMARY
74+
echo "📦 Published to: GitHub Packages (private)" >> $GITHUB_STEP_SUMMARY
75+
echo "" >> $GITHUB_STEP_SUMMARY
76+
echo "## Install in your plugin:" >> $GITHUB_STEP_SUMMARY
77+
echo "" >> $GITHUB_STEP_SUMMARY
78+
echo "Update package.json:" >> $GITHUB_STEP_SUMMARY
79+
echo '```json' >> $GITHUB_STEP_SUMMARY
80+
echo '"@envoy/envoy-integrations-sdk": "${{ steps.rc-version.outputs.version }}"' >> $GITHUB_STEP_SUMMARY
81+
echo '```' >> $GITHUB_STEP_SUMMARY
82+
echo "" >> $GITHUB_STEP_SUMMARY
83+
echo "Or install directly:" >> $GITHUB_STEP_SUMMARY
84+
echo '```bash' >> $GITHUB_STEP_SUMMARY
85+
echo "npm install @envoy/envoy-integrations-sdk@${{ steps.rc-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
86+
echo '```' >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)