@@ -113,12 +113,19 @@ jobs:
113113 id : publish_github
114114 run : |
115115 npm pkg set name="@${{ github.repository_owner }}/git-ai"
116- npm publish --access public 2>&1 | tee publish_output.txt
116+ npm publish --access public 2>&1 | tee publish_output.txt || true
117117 if grep -q "You cannot publish over the previously published versions" publish_output.txt; then
118118 echo "::notice::Version already exists on GitHub Packages, skipping"
119119 echo "skipped=true" >> "$GITHUB_OUTPUT"
120- elif [ ${PIPESTATUS[0]} -ne 0 ]; then
120+ elif grep -q "^\+ @${{ github.repository_owner }}/git-ai@" publish_output.txt; then
121+ echo "::notice::Successfully published to GitHub Packages"
122+ echo "skipped=false" >> "$GITHUB_OUTPUT"
123+ elif grep -q "npm error 40[13]" publish_output.txt; then
124+ echo "::warning::GitHub Packages publish failed with auth error, continuing to npmjs.org"
125+ echo "skipped=true" >> "$GITHUB_OUTPUT"
126+ else
121127 echo "::error::Failed to publish to GitHub Packages"
128+ cat publish_output.txt
122129 exit 1
123130 fi
124131 env :
@@ -144,11 +151,16 @@ jobs:
144151 if grep -q "You cannot publish over the previously published versions" publish_output.txt; then
145152 echo "::notice::Version already exists on npmjs.org, skipping"
146153 echo "skipped=true" >> "$GITHUB_OUTPUT"
154+ elif grep -q "^\+ @mars167/git-ai@" publish_output.txt; then
155+ echo "::notice::Successfully published to npmjs.org"
156+ echo "skipped=false" >> "$GITHUB_OUTPUT"
147157 elif grep -q "npm error" publish_output.txt; then
148158 echo "::error::Failed to publish to npmjs.org"
149159 cat publish_output.txt
150160 exit 1
151161 else
162+ echo "::warning::Unexpected npm publish output, check logs"
163+ cat publish_output.txt
152164 echo "skipped=false" >> "$GITHUB_OUTPUT"
153165 fi
154166 env :
0 commit comments