Skip to content

Commit 70b420c

Browse files
author
Robin Bryce
committed
ci: export and upload outputs as gh artefacts
1 parent ebed5e1 commit 70b420c

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,21 @@ jobs:
2222
# Note: it is by design that we don't use the builder
2323
task apis:bootstrap
2424
task apis:generate
25+
task apis:export
2526
27+
- uses: actions/upload-artifact@v3
28+
with:
29+
name: go-datatrails-common-api-gen
30+
path: exported/datatrails-common-api-gen
31+
32+
- uses: actions/upload-artifact@v3
33+
with:
34+
name: go-datatrails-common-api-proto
35+
# both datatrails-common-api protos & upstream ones under a single
36+
# -I dir compatible location
37+
path: exported/proto-include
2638

39+
- uses: actions/upload-artifact@v3
40+
with:
41+
name: go-datatrails-common-api-swagger
42+
path: exported/swagger

taskfiles/Taskfile_apis.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ vars:
2323

2424
# DESTDIR
2525
# The path, relative to the api dir, where the outputs should be rooted.
26+
# * The common apis are exported to DESTDIR/api
27+
# * The necessary upstream includes are exported to DESTDIR/proto-include
2628
#
2729
# When using DESTDIR to create output paths, do NOT insert '/' characters.
2830
# Please do {{.DESTDIR}}{{.OUTDIR}} rather than {{.DESTDIR}}/{{.OUTDIR}}
2931
# Note that making DESTDIR=. does not work (cp same file to same file)
30-
DESTDIR: '{{.DESTDIR | default "../exported/api/"}}'
31-
32+
#
33+
DESTDIR: '{{.DESTDIR | default "../exported/"}}'
3234

3335
# see https://github.com/golang/protobuf/issues/143
3436
# field_mask is a well known type that is recommend for use with UPDATE
@@ -72,8 +74,9 @@ tasks:
7274
rm -rf {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}
7375
mkdir -p {{.PROTO_INC_ROOT}}
7476
tar -C {{.PROTO_INC_ROOT}} -xvzf {{.GOOGLE_COMMON_PROTOS_VERSION}}.tar.gz
75-
mv {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_ARCHIVE_BASEDIR}}-{{.GOOGLE_COMMON_PROTOS_VERSION}} \
76-
{{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}
77+
mkdir -p {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}
78+
mv {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_ARCHIVE_BASEDIR}}-{{.GOOGLE_COMMON_PROTOS_VERSION}}/google \
79+
{{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}/
7780
rm -f {{.GOOGLE_COMMON_PROTOS_VERSION}}.tar.gz
7881
find {{.GOOGLE_INC}} -type d
7982
@@ -98,17 +101,29 @@ tasks:
98101
attribute/v2/attribute
99102
caps/v1/caps
100103
filter/v1/filter
104+
# The defaults match the expectations of .github/workflows/ci.yml
105+
COMMON_GODIR: datatrails-common-api-gen
106+
COMMON_PROTODIR: datatrails-common-api
101107
cmds:
102108
- |
103-
mkdir -p {{.DESTDIR}}
109+
mkdir -p {{.DESTDIR}}{{.COMMON_GODIR}}
104110
for name in {{.SOURCES}}; do
105-
cp -vr ${name} {{.DESTDIR}}
111+
cp -vr ${name} {{.DESTDIR}}{{.COMMON_GODIR}}/
106112
done
113+
114+
mkdir -p {{.DESTDIR}}/proto-include/{{.COMMON_PROTODIR}}
115+
mkdir -p {{.DESTDIR}}/swagger
116+
117+
# The source protos are all gathered under a 'google' common top dir
118+
cp -vr {{.GOOGLE_INC}}/* {{.DESTDIR}}proto-include/
119+
107120
for api in {{.APIS}}; do
108-
mkdir -vp {{.DESTDIR}}${api}
109-
cp -vr ${api}/*.go {{.DESTDIR}}${api}/
110-
cp -vr ${api}/*.swagger.json {{.DESTDIR}}${api}/
111-
cp -vr ${api}/*.proto {{.DESTDIR}}${api}/
121+
mkdir -vp {{.DESTDIR}}{{.COMMON_GODIR}}/${api}
122+
cp -vr ${api}/*.go {{.DESTDIR}}{{.COMMON_GODIR}}/${api}
123+
mkdir -vp {{.DESTDIR}}swagger/${api}
124+
cp -vr ${api}/*.swagger.json {{.DESTDIR}}swagger/${api}
125+
mkdir -vp {{.DESTDIR}}proto-include/{{.COMMON_PROTODIR}}/${api}
126+
cp -vr ${api}/*.proto {{.DESTDIR}}proto-include/{{.COMMON_PROTODIR}}/${api}
112127
done
113128
114129

0 commit comments

Comments
 (0)