@@ -24,22 +24,24 @@ jobs:
24
24
task apis:generate
25
25
task apis:export
26
26
27
- - uses : actions/upload-artifact@v3
28
- with :
29
- name : go-datatrails-common-api-gen
30
- path : exported/datatrails-common-api-gen
31
-
32
27
- uses : actions/upload-artifact@v3
33
28
with :
34
29
name : go-datatrails-common-api-proto
35
30
# both datatrails-common-api protos & upstream ones under a single
36
31
# -I dir compatible location
37
32
path : exported/proto-include
38
33
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
+
43
45
44
46
release :
45
47
runs-on : ubuntu-latest
52
54
path : exported/proto-include
53
55
- name : show files
54
56
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