File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 24
24
jobs :
25
25
publish-x402-package :
26
26
runs-on : self-hosted
27
- environment : npm
27
+ # Only use the npm environment on main branch
28
+ environment : ${{ github.ref == 'refs/heads/main' && 'npm' || '' }}
28
29
permissions :
29
30
contents : read
30
31
id-token : write
93
94
}
94
95
EOF
95
96
96
- - name : Publish ${{ matrix.package }} package
97
+ - name : Publish ${{ matrix.package }} package (dry-run for non-main branches)
97
98
working-directory : ./x402/packages/typescript/x402
98
99
run : |
99
100
SELECTED="${{ matrix.package }}"
@@ -104,6 +105,14 @@ jobs:
104
105
PACKAGE_NAME=$(node -p "require('./package.json').name")
105
106
106
107
echo "Publishing $PACKAGE_NAME@$PACKAGE_VERSION"
107
- # npm publish --provenance --access public
108
+
109
+ # Only publish on main branch, do dry-run otherwise
110
+ if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
111
+ echo "Running on main branch - would publish for real"
112
+ # npm publish --provenance --access public
113
+ else
114
+ echo "Running on non-main branch (${{ github.ref }}) - dry run only"
115
+ # npm publish --dry-run --provenance --access public
116
+ fi
108
117
env :
109
118
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments