Skip to content

Commit f2612a2

Browse files
committed
chore: fix release CI workflow
1 parent a3f0851 commit f2612a2

3 files changed

Lines changed: 21 additions & 24 deletions

File tree

.github/workflows/publish-npm-latest.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,29 +122,28 @@ jobs:
122122
shell: bash
123123
run: |
124124
# 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) {
125+
pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }} || {
128126
# Check for EOTP error
129-
if [[ "$error" == *"EOTP"* ]]; then
127+
if [[ "$output" == *"EOTP"* ]]; then
130128
echo "::error title=OTP Expired::OTP has expired. Please provide a new OTP."
131129
# Prompt for a new OTP
132-
OTP=$(step-security/wait-for-secrets@v1 \
130+
OTP=$(\
131+
uses: step-security/wait-for-secrets@v1 \
133132
secrets: |
134133
OTP:
135134
name: 'New OTP to publish package'
136135
description: 'OTP from authenticator app' \
137-
)
136+
)
138137
# Retry the publish command with the new OTP
139138
pnpm exec lerna publish from-package --force-publish --yes --otp $OTP
140139
# Check for version conflict error (replace with your actual check)
141-
elif [[ "$error" == *"version conflict"* ]]; then
140+
elif [[ "$output" == *"version conflict"* ]]; then
142141
echo "::warning title=Version Conflict::A package has a version conflict. Skipping."
143142
else
144143
# Fail the workflow for other errors
145144
echo "::error title=Publish Failed::Publishing failed with an unexpected error."
146145
exit 1
147-
}
146+
fi
148147
}
149148
150149
- name: Website Dev Build

.github/workflows/publish-npm-prerelease.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,26 @@ jobs:
171171
shell: bash
172172
run: |
173173
# 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) {
174+
pnpm exec lerna publish from-package --force-publish --dist-tag ${{ inputs.tag }} --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }} || {
177175
# Check for EOTP error
178-
if [[ "$error" == *"EOTP"* ]]; then
176+
if [[ "$output" == *"EOTP"* ]]; then
179177
echo "::error title=OTP Expired::OTP has expired. Please provide a new OTP."
180178
# Prompt for a new OTP
181-
OTP=$(step-security/wait-for-secrets@v1 \
179+
OTP=$(\
180+
uses: step-security/wait-for-secrets@v1 \
182181
secrets: |
183182
OTP:
184183
name: 'New OTP to publish package'
185184
description: 'OTP from authenticator app' \
186-
)
185+
)
187186
# Retry the publish command with the new OTP
188187
pnpm exec lerna publish from-package --force-publish --dist-tag ${{ inputs.tag }} --yes --otp $OTP
189188
# Check for version conflict error (replace with your actual check)
190-
elif [[ "$error" == *"version conflict"* ]]; then
189+
elif [[ "$output" == *"version conflict"* ]]; then
191190
echo "::warning title=Version Conflict::A package has a version conflict. Skipping."
192191
else
193192
# Fail the workflow for other errors
194193
echo "::error title=Publish Failed::Publishing failed with an unexpected error."
195194
exit 1
196-
}
195+
fi
197196
}

.github/workflows/publish-npm-prompt.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,28 @@ jobs:
121121
shell: bash
122122
run: |
123123
# 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) {
124+
pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }} || {
127125
# Check for EOTP error
128-
if [[ "$error" == *"EOTP"* ]]; then
126+
if [[ "$output" == *"EOTP"* ]]; then
129127
echo "::error title=OTP Expired::OTP has expired. Please provide a new OTP."
130128
# Prompt for a new OTP
131-
OTP=$(step-security/wait-for-secrets@v1 \
129+
OTP=$(\
130+
uses: step-security/wait-for-secrets@v1 \
132131
secrets: |
133132
OTP:
134133
name: 'New OTP to publish package'
135134
description: 'OTP from authenticator app' \
136-
)
135+
)
137136
# Retry the publish command with the new OTP
138137
pnpm exec lerna publish from-package --force-publish --yes --otp $OTP
139138
# Check for version conflict error (replace with your actual check)
140-
elif [[ "$error" == *"version conflict"* ]]; then
139+
elif [[ "$output" == *"version conflict"* ]]; then
141140
echo "::warning title=Version Conflict::A package has a version conflict. Skipping."
142141
else
143142
# Fail the workflow for other errors
144143
echo "::error title=Publish Failed::Publishing failed with an unexpected error."
145144
exit 1
146-
}
145+
fi
147146
}
148147
149148
- name: Website Dev Build

0 commit comments

Comments
 (0)