-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path_job-release-integration-yml.hbs
45 lines (43 loc) · 1.24 KB
/
_job-release-integration-yml.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: {{#if publish}}Publish{{else}}Check Publish{{/if}}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
{{#if publish}}
permissions:
id-token: write
{{/if}}
steps:
{{#if publish}}
{{> stepsSetupYml jobCheckout=(obj ref="${{ fromJSON(inputs.releases)[0].tagName }}") }}
- name: Set npm authToken
run: npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN}
- name: Publish
env:
PUBLISH_TOKEN: $\{{ secrets.PUBLISH_TOKEN }}
RELEASES: $\{{ inputs.releases }}
{{else}}
{{> stepsSetupYml }}
- name: Check If Published
{{/if}}
run: |
EXIT_CODE=0
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
{{#if publish}}
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
npm publish --provenance --tag="$PUBLISH_TAG"
{{else}}
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
npm view "$SPEC" --json
{{/if}}
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
{{#unless publish}}
echo "$SPEC ERROR"
else
echo "$SPEC OK"
{{/unless}}
fi
done
exit $EXIT_CODE