File tree Expand file tree Collapse file tree 2 files changed +6
-35
lines changed Expand file tree Collapse file tree 2 files changed +6
-35
lines changed Original file line number Diff line number Diff line change 7
7
key : release
8
8
env :
9
9
RELEASE_VERSION : " __TEMPLATE__"
10
+ plugins :
11
+ - rubygems-oidc#bashify:
12
+ role : " rg_oidc_akr_xoy8sqmj25t8ok4rn5sq"
10
13
Original file line number Diff line number Diff line change 2
2
3
3
set -euo pipefail
4
4
5
- echo " --- Request OIDC token"
6
-
7
- export BUILDKITE_OIDC_TOKEN=" $( buildkite-agent oidc request-token --audience " rubygems.org" --lifetime 60) "
8
-
9
- echo " ${BUILDKITE_OIDC_TOKEN} " | head -c 20
10
- echo
11
-
12
- echo " --- Request rubygems token"
13
-
14
- RUBYGEMS_ROLE=" rg_oidc_akr_xoy8sqmj25t8ok4rn5sq"
15
-
16
- echo " {\" jwt\" :\" ${BUILDKITE_OIDC_TOKEN} \" }" | head -c 30
17
- echo
18
-
19
- # curl -v -s -X POST \
20
- # --fail-with-body \
21
- # -H "Content-Type: application/json" \
22
- # --data "{\"jwt\":\"${BUILDKITE_OIDC_TOKEN}\"}" \
23
- # "https://rubygems.org/api/v1/oidc/api_key_roles/${RUBYGEMS_ROLE}/assume_role"
24
-
25
- # --fail-with-body \
26
- RESPONSE=$( curl -s -X POST \
27
- -H " Content-Type: application/json" \
28
- --data " {\" jwt\" :\" ${BUILDKITE_OIDC_TOKEN} \" }" \
29
- " https://rubygems.org/api/v1/oidc/api_key_roles/${RUBYGEMS_ROLE} /assume_role" )
30
-
31
- ERROR_MESSAGE=$( echo " ${RESPONSE} " | jq -r .error)
32
- GEM_HOST_API_KEY==$( echo " ${RESPONSE} " | jq -r .rubygems_api_key)
33
-
34
- if [ " ${ERROR_MESSAGE} " != " null" ]; then
35
- echo " Requesting API token failed"
36
- echo " ERROR: ${ERROR_MESSAGE} "
37
- exit 1
5
+ if [ -z " ${GEM_HOST_API_KEY} " ]; then
6
+ echo " GEM_HOST_API_KEY environment variable not found"
7
+ exit
38
8
fi
39
9
40
- echo " ${GEM_HOST_API_KEY} " | head -c 10
41
-
42
10
echo " --- Build and publish gem"
43
11
44
12
cd $( dirname $0 ) /..
You can’t perform that action at this time.
0 commit comments