Skip to content

Commit 2c79a4d

Browse files
author
Robin Bryce
committed
ci: developing release job
1 parent 7c70815 commit 2c79a4d

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

Diff for: .github/workflows/ci.yml

+41-10
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,24 @@ jobs:
2424
task apis:generate
2525
task apis:export
2626
27-
- uses: actions/upload-artifact@v3
28-
with:
29-
name: go-datatrails-common-api-gen
30-
path: exported/datatrails-common-api-gen
31-
3227
- uses: actions/upload-artifact@v3
3328
with:
3429
name: go-datatrails-common-api-proto
3530
# both datatrails-common-api protos & upstream ones under a single
3631
# -I dir compatible location
3732
path: exported/proto-include
3833

39-
- uses: actions/upload-artifact@v3
40-
with:
41-
name: go-datatrails-common-api-swagger
42-
path: exported/swagger
34+
# disabled until protos work
35+
#- uses: actions/upload-artifact@v3
36+
# with:
37+
# name: go-datatrails-common-api-swagger
38+
# path: exported/swagger
39+
40+
#- uses: actions/upload-artifact@v3
41+
# with:
42+
# name: go-datatrails-common-api-gen
43+
# path: exported/datatrails-common-api-gen
44+
4345

4446
release:
4547
runs-on: ubuntu-latest
@@ -52,4 +54,33 @@ jobs:
5254
path: exported/proto-include
5355
- name: show files
5456
working-directory: exported/proto-include
55-
run: ls -R
57+
run: ls -R
58+
- name: Upload proto files
59+
working-directory: exported
60+
run: |
61+
TAG="$(echo "${GITHUB_REF}" | grep tags | grep -o "[^/]*$" || true)"
62+
if [ -z "$TAG" ]; then
63+
echo "::error ::This is not a tagged push"
64+
exit 1
65+
fi
66+
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
67+
RELEASE_ID=$TAG
68+
69+
echo "Verifying release"
70+
HTTP_RESPONSE=$(curl --write-out "HTTPSTATUS:%{http_code}" \
71+
-sSL \
72+
-H "${AUTH_HEADER}" \
73+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_ID}")
74+
75+
HTTP_STATUS=$(echo "$HTTP_RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
76+
77+
if [[ "$HTTP_STATUS" -ne 200 ]]; then
78+
echo "::error ::Release is missing"
79+
exit 1
80+
fi
81+
path=proto-include
82+
83+
if [[ ! -d $path ]]; then exit 1; fi
84+
85+
ghr -u "${GITHUB_REPOSITORY%/*}" -r "${GITHUB_REPOSITORY#*/}" "${GITHUB_REF#refs/tags/}" "${path}"
86+
echo "::debug ::Uploaded $path"

0 commit comments

Comments
 (0)