Skip to content

Commit be3c3fe

Browse files
committed
adding dry run
1 parent 128ebb6 commit be3c3fe

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/publish_x402_matrix.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ on:
2424
jobs:
2525
publish-x402-package:
2626
runs-on: self-hosted
27-
environment: npm
27+
# Only use the npm environment on main branch
28+
environment: ${{ github.ref == 'refs/heads/main' && 'npm' || '' }}
2829
permissions:
2930
contents: read
3031
id-token: write
@@ -93,7 +94,7 @@ jobs:
9394
}
9495
EOF
9596
96-
- name: Publish ${{ matrix.package }} package
97+
- name: Publish ${{ matrix.package }} package (dry-run for non-main branches)
9798
working-directory: ./x402/packages/typescript/x402
9899
run: |
99100
SELECTED="${{ matrix.package }}"
@@ -104,6 +105,14 @@ jobs:
104105
PACKAGE_NAME=$(node -p "require('./package.json').name")
105106
106107
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
108117
env:
109118
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)