File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish to GitHub Packages
2+
3+ on :
4+ workflow_dispatch :
5+
6+ jobs :
7+ publish-gpr :
8+ name : Publish to GitHub Packages
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : read
12+ packages : write
13+ steps :
14+ - name : Parse tag
15+ id : parse
16+ run : |
17+ TAG="${{ github.ref_name }}"
18+ # Extract package name and version from tag like @cometloop/safe@0.1.0
19+ NAME="${TAG%@*}"
20+ VERSION="${TAG##*@}"
21+ DIR="packages/${NAME#@cometloop/}"
22+ echo "name=${NAME}" >> "$GITHUB_OUTPUT"
23+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
24+ echo "dir=${DIR}" >> "$GITHUB_OUTPUT"
25+ echo "Publishing ${NAME}@${VERSION} from ${DIR}"
26+
27+ - uses : actions/checkout@v4
28+
29+ - uses : pnpm/action-setup@v4
30+
31+ - uses : actions/setup-node@v4
32+ with :
33+ node-version : 22
34+ cache : pnpm
35+
36+ - run : pnpm install --frozen-lockfile
37+
38+ - run : pnpm --filter "${{ steps.parse.outputs.name }}" build
39+
40+ - name : Publish to GitHub Packages
41+ run : |
42+ echo "@cometloop:registry=https://npm.pkg.github.com" > "$RUNNER_TEMP/.npmrc_gpr"
43+ echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> "$RUNNER_TEMP/.npmrc_gpr"
44+
45+ npm publish "./${{ steps.parse.outputs.dir }}" \
46+ --userconfig="$RUNNER_TEMP/.npmrc_gpr" \
47+ --provenance=false \
48+ --access=public
49+ env :
50+ NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments