File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,9 +119,33 @@ jobs:
119119 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
120120 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
121121 NPM_CONFIG_PROVENANCE : true
122- HUSKY : 0
122+ shell : bash
123123 run : |
124- pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
124+ # Attempt to publish all packages
125+ try {
126+ pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
127+ } catch (error) {
128+ # Check for EOTP error
129+ if [[ "$error" == *"EOTP"* ]]; then
130+ echo "::error title=OTP Expired::OTP has expired. Please provide a new OTP."
131+ # Prompt for a new OTP
132+ OTP=$(step-security/wait-for-secrets@v1 \
133+ secrets: |
134+ OTP:
135+ name: 'New OTP to publish package'
136+ description: 'OTP from authenticator app' \
137+ )
138+ # Retry the publish command with the new OTP
139+ pnpm exec lerna publish from-package --force-publish --yes --otp $OTP
140+ # Check for version conflict error (replace with your actual check)
141+ elif [[ "$error" == *"version conflict"* ]]; then
142+ echo "::warning title=Version Conflict::A package has a version conflict. Skipping."
143+ else
144+ # Fail the workflow for other errors
145+ echo "::error title=Publish Failed::Publishing failed with an unexpected error."
146+ exit 1
147+ }
148+ }
125149
126150 - name : Website Dev Build
127151 run : pnpm build:dev
Original file line number Diff line number Diff line change @@ -168,6 +168,30 @@ jobs:
168168 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
169169 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
170170 NPM_CONFIG_PROVENANCE : true
171- HUSKY : 0
171+ shell : bash
172172 run : |
173- pnpm exec lerna publish from-package --force-publish --dist-tag ${{ inputs.tag }} --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
173+ # Attempt to publish all packages
174+ try {
175+ pnpm exec lerna publish from-package --force-publish --dist-tag ${{ inputs.tag }} --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
176+ } catch (error) {
177+ # Check for EOTP error
178+ if [[ "$error" == *"EOTP"* ]]; then
179+ echo "::error title=OTP Expired::OTP has expired. Please provide a new OTP."
180+ # Prompt for a new OTP
181+ OTP=$(step-security/wait-for-secrets@v1 \
182+ secrets: |
183+ OTP:
184+ name: 'New OTP to publish package'
185+ description: 'OTP from authenticator app' \
186+ )
187+ # Retry the publish command with the new OTP
188+ pnpm exec lerna publish from-package --force-publish --dist-tag ${{ inputs.tag }} --yes --otp $OTP
189+ # Check for version conflict error (replace with your actual check)
190+ elif [[ "$error" == *"version conflict"* ]]; then
191+ echo "::warning title=Version Conflict::A package has a version conflict. Skipping."
192+ else
193+ # Fail the workflow for other errors
194+ echo "::error title=Publish Failed::Publishing failed with an unexpected error."
195+ exit 1
196+ }
197+ }
Original file line number Diff line number Diff line change @@ -113,13 +113,38 @@ jobs:
113113 description: 'OTP from authenticator app'
114114
115115 - name : Lerna Publish 📦
116+ if : ${{ inputs.dryrun != true }}
116117 env :
117118 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118119 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
119120 NPM_CONFIG_PROVENANCE : true
120- HUSKY : 0
121+ shell : bash
121122 run : |
122- pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
123+ # Attempt to publish all packages
124+ try {
125+ pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
126+ } catch (error) {
127+ # Check for EOTP error
128+ if [[ "$error" == *"EOTP"* ]]; then
129+ echo "::error title=OTP Expired::OTP has expired. Please provide a new OTP."
130+ # Prompt for a new OTP
131+ OTP=$(step-security/wait-for-secrets@v1 \
132+ secrets: |
133+ OTP:
134+ name: 'New OTP to publish package'
135+ description: 'OTP from authenticator app' \
136+ )
137+ # Retry the publish command with the new OTP
138+ pnpm exec lerna publish from-package --force-publish --yes --otp $OTP
139+ # Check for version conflict error (replace with your actual check)
140+ elif [[ "$error" == *"version conflict"* ]]; then
141+ echo "::warning title=Version Conflict::A package has a version conflict. Skipping."
142+ else
143+ # Fail the workflow for other errors
144+ echo "::error title=Publish Failed::Publishing failed with an unexpected error."
145+ exit 1
146+ }
147+ }
123148
124149 - name : Website Dev Build
125150 run : pnpm build:dev
You can’t perform that action at this time.
0 commit comments