-
Notifications
You must be signed in to change notification settings - Fork 1
210 lines (176 loc) · 8.04 KB
/
build.yaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: build
on:
push:
branches:
- master
- main
- bids23
paths:
# Only rebuild website when apps have changed
- 'water-bodies/**'
- .github/**
- docs/**
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install cwltool
- run: cwltool --validate cwl-workflow/app-water-bodies-cloud-native.cwl
- run: cwltool --validate cwl-workflow/app-water-body-cloud-native.cwl
- run: cwltool --validate cwl-workflow/app-water-body.cwl
version:
needs: validate
runs-on: ubuntu-latest
outputs:
app-version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v2
- run: wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O ./yq
env:
VERSION: v4.2.0
BINARY: yq_linux_amd64
- run: chmod +x ./yq
- run: echo "APP_VERSION=$( ./yq e '."s:softwareVersion"' cwl-workflow/app-water-body.cwl | tr -d "\n" )" >> $GITHUB_ENV
- run: echo app version is $APP_VERSION
- id: set-version
run: echo "::set-output name=version::$APP_VERSION"
container-crop:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo version ${{needs.version.outputs.app-version}}
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: build & push crop image
run: |
IMAGE_ID=ghcr.io/terradue/app-package-training-bids23/crop
docker build water-bodies/command-line-tools/crop --file water-bodies/command-line-tools/crop/Dockerfile --tag crop
docker tag crop $IMAGE_ID:${{needs.version.outputs.app-version}}
docker push $IMAGE_ID:${{needs.version.outputs.app-version}}
container-normalized-difference:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo version ${{needs.version.outputs.app-version}}
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: build & push norm_diff image
run: |
IMAGE_ID=ghcr.io/terradue/app-package-training-bids23/norm_diff
docker build water-bodies/command-line-tools/norm_diff --file water-bodies/command-line-tools/norm_diff/Dockerfile --tag norm_diff
docker tag norm_diff $IMAGE_ID:${{needs.version.outputs.app-version}}
docker push $IMAGE_ID:${{needs.version.outputs.app-version}}
container-otsu:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo version ${{needs.version.outputs.app-version}}
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: build & push otsu image
run: |
IMAGE_ID=ghcr.io/terradue/app-package-training-bids23/otsu
docker build water-bodies/command-line-tools/otsu --file water-bodies/command-line-tools/otsu/Dockerfile --tag otsu
docker tag otsu $IMAGE_ID:${{needs.version.outputs.app-version}}
docker push $IMAGE_ID:${{needs.version.outputs.app-version}}
container-stac:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo version ${{needs.version.outputs.app-version}}
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: build & push stac image
run: |
IMAGE_ID=ghcr.io/terradue/app-package-training-bids23/stac
docker build water-bodies/command-line-tools/stac --file water-bodies/command-line-tools/stac/Dockerfile --tag stac
docker tag stac $IMAGE_ID:${{needs.version.outputs.app-version}}
docker push $IMAGE_ID:${{needs.version.outputs.app-version}}
container-stage:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo version ${{needs.version.outputs.app-version}}
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: build & push stage image
run: |
IMAGE_ID=ghcr.io/terradue/app-package-training-bids23/stage
docker build . --file water-bodies/command-line-tools/stage/Dockerfile --tag stage
docker tag stage $IMAGE_ID:${{needs.version.outputs.app-version}}
docker push $IMAGE_ID:${{needs.version.outputs.app-version}}
publish-artifacts:
needs:
- container-crop
- container-normalized-difference
- container-otsu
- container-stac
- version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
code_repository=$( cat codemeta.json | jq -r ".codeRepository" )
for step in crop norm_diff otsu stac
do
tag="ghcr.io/terradue/app-package-training-bids23/${step}:${{needs.version.outputs.app-version}}"
docker pull ${tag}
shatag=$( docker inspect ${tag} | yq -r '.[0]["RepoDigests"][0]' )
s="${step}" t="${shatag}" yq -i eval '(.$graph[] | select (.id == env(s)) ).hints.DockerRequirement.dockerPull = env(t)' cwl-workflow/app-water-bodies-cloud-native.cwl
s="${step}" t="${shatag}" yq -i eval '(.$graph[] | select (.id == env(s)) ).hints.DockerRequirement.dockerPull = env(t)' cwl-workflow/app-water-body-cloud-native.cwl
s="${step}" t="${shatag}" yq -i eval '(.$graph[] | select (.id == env(s)) ).hints.DockerRequirement.dockerPull = env(t)' cwl-workflow/app-water-body.cwl
r="${code_repository}" yq -i eval '."s:codeRepository" = {"URL" : env(r)}' cwl-workflow/app-water-bodies-cloud-native.cwl
r="${code_repository}" yq -i eval '."s:codeRepository" = {"URL" : env(r)}' cwl-workflow/app-water-body-cloud-native.cwl
r="${code_repository}" yq -i eval '."s:codeRepository" = {"URL" : env(r)}' cwl-workflow/app-water-body.cwl
done
- run: mkdir downloads
- run: |
cp cwl-workflow/app-water-bodies-cloud-native.cwl downloads/app-water-bodies-cloud-native.${{needs.version.outputs.app-version}}.cwl
cp cwl-workflow/app-water-body-cloud-native.cwl downloads/app-water-body-cloud-native.${{needs.version.outputs.app-version}}.cwl
cp cwl-workflow/app-water-body.cwl downloads/app-water-body.${{needs.version.outputs.app-version}}.cwl
- uses: actions/upload-artifact@v2
with:
name: application-package
path: downloads
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{needs.version.outputs.app-version}}
tag_name: ${{needs.version.outputs.app-version}}
#body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload linux artifact 1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: downloads/app-water-bodies-cloud-native.${{needs.version.outputs.app-version}}.cwl
asset_name: app-water-bodies-cloud-native.${{needs.version.outputs.app-version}}.cwl
asset_content_type: text/yaml
- name: upload linux artifact 2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: downloads/app-water-body-cloud-native.${{needs.version.outputs.app-version}}.cwl
asset_name: app-water-body-cloud-native.${{needs.version.outputs.app-version}}.cwl
asset_content_type: text/yaml
- name: upload linux artifact 3
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: downloads/app-water-body.${{needs.version.outputs.app-version}}.cwl
asset_name: app-water-body.${{needs.version.outputs.app-version}}.cwl
asset_content_type: text/yaml