@@ -28,11 +28,51 @@ jobs:
2828 outputs :
2929 shouldrun : ${{ steps.should_run.outputs.shouldrun }}
3030
31+ build-docker :
32+ needs : should-workflow-run
33+ name : Build Docker image
34+ if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
35+ runs-on : ubuntu-latest
36+ steps :
37+ - uses : actions/checkout@v4
38+ - name : Get docker version
39+ id : docker_version
40+ run : >
41+ ls -la;
42+ action=$(cat action.yml);
43+ regex='docker:\/\/asyncapi\/github-action-for-cli:([0-9.]+)';
44+ [[ $action =~ $regex ]];
45+ action_version=${BASH_REMATCH[1]};
46+ echo "action_version=$action_version" >> $GITHUB_OUTPUT
47+ - name : Set up Docker Buildx
48+ uses : docker/setup-buildx-action@v3
49+ - name : Build Docker image and export
50+ uses : docker/build-push-action@v5
51+ with :
52+ context : .
53+ tags : asyncapi/github-action-for-cli:${{ steps.docker_version.outputs.action_version }}
54+ outputs : type=docker,dest=/tmp/asyncapi.tar
55+ - name : Upload artifact
56+ uses : actions/upload-artifact@v3
57+ with :
58+ name : asyncapi
59+ path : /tmp/asyncapi.tar
60+
61+
3162 test-defaults :
3263 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
3364 runs-on : ubuntu-latest
34- needs : should-workflow-run
65+ needs : [ should-workflow-run, build-docker]
3566 steps :
67+ - name : Download artifact
68+ uses : actions/download-artifact@v3
69+ with :
70+ name : asyncapi
71+ path : /tmp
72+ - name : Load Docker image
73+ run : |
74+ docker load --input /tmp/asyncapi.tar
75+ docker image ls -a
3676 - uses : actions/checkout@v4
3777 - name : Test GitHub Action
3878 uses : ./
5494 test-validate-success :
5595 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
5696 runs-on : ubuntu-latest
57- needs : should-workflow-run
97+ needs : [ should-workflow-run, build-docker]
5898 steps :
99+ - name : Download artifact
100+ uses : actions/download-artifact@v3
101+ with :
102+ name : asyncapi
103+ path : /tmp
104+ - name : Load Docker image
105+ run : |
106+ docker load --input /tmp/asyncapi.tar
107+ docker image ls -a
59108 - uses : actions/checkout@v4
60109 - name : Test GitHub Action
61110 uses : ./
@@ -66,8 +115,17 @@ jobs:
66115 test-custom-command :
67116 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
68117 runs-on : ubuntu-latest
69- needs : should-workflow-run
118+ needs : [ should-workflow-run, build-docker]
70119 steps :
120+ - name : Download artifact
121+ uses : actions/download-artifact@v3
122+ with :
123+ name : asyncapi
124+ path : /tmp
125+ - name : Load Docker image
126+ run : |
127+ docker load --input /tmp/asyncapi.tar
128+ docker image ls -a
71129 - uses : actions/checkout@v4
72130 - name : Test GitHub Action
73131 uses : ./
@@ -91,8 +149,17 @@ jobs:
91149 test-custom-output :
92150 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
93151 runs-on : ubuntu-latest
94- needs : should-workflow-run
152+ needs : [ should-workflow-run, build-docker]
95153 steps :
154+ - name : Download artifact
155+ uses : actions/download-artifact@v3
156+ with :
157+ name : asyncapi
158+ path : /tmp
159+ - name : Load Docker image
160+ run : |
161+ docker load --input /tmp/asyncapi.tar
162+ docker image ls -a
96163 - uses : actions/checkout@v4
97164 - name : Test GitHub Action
98165 uses : ./
@@ -115,8 +182,17 @@ jobs:
115182 test-file-not-found :
116183 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
117184 runs-on : ubuntu-latest
118- needs : should-workflow-run
185+ needs : [ should-workflow-run, build-docker]
119186 steps :
187+ - name : Download artifact
188+ uses : actions/download-artifact@v3
189+ with :
190+ name : asyncapi
191+ path : /tmp
192+ - name : Load Docker image
193+ run : |
194+ docker load --input /tmp/asyncapi.tar
195+ docker image ls -a
120196 - uses : actions/checkout@v4
121197 - name : Test GitHub Action
122198 id : test
@@ -136,8 +212,17 @@ jobs:
136212 test-invalid-input :
137213 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
138214 runs-on : ubuntu-latest
139- needs : should-workflow-run
215+ needs : [ should-workflow-run, build-docker]
140216 steps :
217+ - name : Download artifact
218+ uses : actions/download-artifact@v3
219+ with :
220+ name : asyncapi
221+ path : /tmp
222+ - name : Load Docker image
223+ run : |
224+ docker load --input /tmp/asyncapi.tar
225+ docker image ls -a
141226 - uses : actions/checkout@v4
142227 - name : Test GitHub Action
143228 id : test
@@ -159,8 +244,17 @@ jobs:
159244 test-optimize :
160245 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
161246 runs-on : ubuntu-latest
162- needs : should-workflow-run
247+ needs : [ should-workflow-run, build-docker]
163248 steps :
249+ - name : Download artifact
250+ uses : actions/download-artifact@v3
251+ with :
252+ name : asyncapi
253+ path : /tmp
254+ - name : Load Docker image
255+ run : |
256+ docker load --input /tmp/asyncapi.tar
257+ docker image ls -a
164258 - uses : actions/checkout@v4
165259 - name : Test GitHub Action
166260 uses : ./
@@ -184,8 +278,17 @@ jobs:
184278 test-bundle :
185279 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
186280 runs-on : ubuntu-latest
187- needs : should-workflow-run
281+ needs : [ should-workflow-run, build-docker]
188282 steps :
283+ - name : Download artifact
284+ uses : actions/download-artifact@v3
285+ with :
286+ name : asyncapi
287+ path : /tmp
288+ - name : Load Docker image
289+ run : |
290+ docker load --input /tmp/asyncapi.tar
291+ docker image ls -a
189292 - uses : actions/checkout@v4
190293 - name : Make output directory
191294 run : mkdir -p ./output/bundle
@@ -209,8 +312,17 @@ jobs:
209312 test-convert :
210313 if : ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
211314 runs-on : ubuntu-latest
212- needs : should-workflow-run
315+ needs : [ should-workflow-run, build-docker]
213316 steps :
317+ - name : Download artifact
318+ uses : actions/download-artifact@v3
319+ with :
320+ name : asyncapi
321+ path : /tmp
322+ - name : Load Docker image
323+ run : |
324+ docker load --input /tmp/asyncapi.tar
325+ docker image ls -a
214326 - uses : actions/checkout@v4
215327 - name : Test GitHub Action
216328 uses : ./
0 commit comments