1+ name : Publish Docker image (latest)
2+
3+ on :
4+ push :
5+ branches :
6+ - ' v5'
7+
8+ concurrency :
9+ group : ${{ github.ref }}
10+ cancel-in-progress : true
11+
12+ env :
13+ FACILMAP_REPO : facilmap/facilmap
14+ # DOCS_REPO: facilmap/facilmap-docs
15+
16+
17+ jobs :
18+ build-facilmap :
19+ strategy :
20+ matrix :
21+ # os: [ubuntu-latest, ubuntu-24.04-arm]
22+ os : [ubuntu-latest]
23+ name : Build FacilMap
24+ runs-on : ${{ matrix.os }}
25+ steps :
26+ -
27+ name : Checkout
28+ uses : actions/checkout@v4
29+
30+ - name : Docker meta
31+ id : meta
32+ uses : docker/metadata-action@v5
33+ with :
34+ images : ${{ env.FACILMAP_REPO }}
35+
36+ -
37+ name : Set up QEMU
38+ uses : docker/setup-qemu-action@v3
39+
40+ -
41+ name : Set up Docker Buildx
42+ uses : docker/setup-buildx-action@v3
43+
44+ -
45+ name : Login to DockerHub
46+ uses : docker/login-action@v3
47+ with :
48+ username : ${{ secrets.DOCKERHUB_USERNAME }}
49+ password : ${{ secrets.DOCKERHUB_TOKEN }}
50+
51+ -
52+ name : Start integration test components in background
53+ run : docker compose -f ./integration-tests/docker-compose.yml up -d --quiet-pull mysql postgres &
54+
55+ -
56+ name : Build and push docker image
57+ id : build
58+ uses : docker/build-push-action@v5
59+ with :
60+ context : .
61+ labels : ${{ steps.meta.outputs.labels }}
62+ outputs : |
63+ type=docker,name=facilmap-ci
64+ type=image,"name=${{ env.FACILMAP_REPO }}",push-by-digest=true,name-canonical=true,push=true
65+
66+ # -
67+ # name: Start integration test components
68+ # run: |
69+ # docker compose -f ./integration-tests/docker-compose.yml up --wait
70+ # status="$?"
71+ # if (( status != 0 )); then
72+ # docker compose -f ./integration-tests/docker-compose.yml logs
73+ # exit "$status"
74+ # fi
75+
76+ # -
77+ # name: Run integration tests
78+ # run: >-
79+ # docker run --rm -u root --add-host host.docker.internal:host-gateway facilmap-ci sh -c "
80+ # yarn workspaces focus facilmap-integration-tests &&
81+ # FACILMAP_URL=http://host.docker.internal:8080 yarn workspace facilmap-integration-tests run integration-tests &&
82+ # FACILMAP_URL=http://host.docker.internal:8081 yarn workspace facilmap-integration-tests run integration-tests
83+ # "
84+
85+ - name : Export digest
86+ run : |
87+ mkdir -p ${{ runner.temp }}/digests
88+ digest="${{ steps.build.outputs.digest }}"
89+ touch "${{ runner.temp }}/digests/${digest#sha256:}"
90+
91+ - name : Upload digest
92+ uses : actions/upload-artifact@v4
93+ with :
94+ name : digests-facilmap-${{ matrix.os }}
95+ path : ${{ runner.temp }}/digests/*
96+ if-no-files-found : error
97+ retention-days : 1
98+
99+ # build-docs:
100+ # strategy:
101+ # matrix:
102+ # os: [ubuntu-latest, ubuntu-24.04-arm]
103+ # name: Build docs
104+ # runs-on: ${{ matrix.os }}
105+ # steps:
106+ # -
107+ # name: Checkout
108+ # uses: actions/checkout@v4
109+
110+ # - name: Docker meta
111+ # id: meta
112+ # uses: docker/metadata-action@v5
113+ # with:
114+ # images: ${{ env.DOCS_REPO }}
115+
116+ # -
117+ # name: Set up QEMU
118+ # uses: docker/setup-qemu-action@v3
119+
120+ # -
121+ # name: Set up Docker Buildx
122+ # uses: docker/setup-buildx-action@v3
123+
124+ # -
125+ # name: Login to DockerHub
126+ # uses: docker/login-action@v3
127+ # with:
128+ # username: ${{ secrets.DOCKERHUB_USERNAME }}
129+ # password: ${{ secrets.DOCKERHUB_TOKEN }}
130+
131+ # -
132+ # name: Build and push docker image
133+ # id: build
134+ # uses: docker/build-push-action@v5
135+ # with:
136+ # context: ./docs
137+ # labels: ${{ steps.meta.outputs.labels }}
138+ # outputs: type=image,"name=${{ env.DOCS_REPO }}",push-by-digest=true,name-canonical=true,push=true
139+
140+ # - name: Export digest
141+ # run: |
142+ # mkdir -p ${{ runner.temp }}/digests
143+ # digest="${{ steps.build.outputs.digest }}"
144+ # touch "${{ runner.temp }}/digests/${digest#sha256:}"
145+
146+ # - name: Upload digest
147+ # uses: actions/upload-artifact@v4
148+ # with:
149+ # name: digests-docs-${{ matrix.os }}
150+ # path: ${{ runner.temp }}/digests/*
151+ # if-no-files-found: error
152+ # retention-days: 1
153+
154+ merge-facilmap :
155+ name : Push FacilMap
156+ runs-on : ubuntu-latest
157+ needs :
158+ - build-facilmap
159+ steps :
160+ - name : Download digests
161+ uses : actions/download-artifact@v4
162+ with :
163+ path : ${{ runner.temp }}/digests
164+ pattern : digests-facilmap-*
165+ merge-multiple : true
166+
167+ - name : Login to Docker Hub
168+ uses : docker/login-action@v3
169+ with :
170+ username : ${{ secrets.DOCKERHUB_USERNAME }}
171+ password : ${{ secrets.DOCKERHUB_TOKEN }}
172+
173+ - name : Set up Docker Buildx
174+ uses : docker/setup-buildx-action@v3
175+
176+ - name : Docker meta
177+ id : meta
178+ uses : docker/metadata-action@v5
179+ with :
180+ images : ${{ env.FACILMAP_REPO }}
181+ flavor : latest=false
182+ tags : |
183+ type=raw,value=v5-alpha
184+ # type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
185+ # type=semver,pattern={{major}}
186+ # type=semver,pattern={{major}}.{{minor}}
187+ # type=semver,pattern={{version}}
188+
189+ - name : Create manifest list and push
190+ working-directory : ${{ runner.temp }}/digests
191+ run : |
192+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
193+ $(printf '${{ env.FACILMAP_REPO }}@sha256:%s ' *)
194+
195+ - name : Inspect image
196+ run : docker buildx imagetools inspect ${{ env.FACILMAP_REPO }}:${{ steps.meta.outputs.version }}
197+
198+
199+ # merge-docs:
200+ # name: Push docs
201+ # runs-on: ubuntu-latest
202+ # needs:
203+ # - build-docs
204+ # - build-facilmap # Do not publish docs if main build failed
205+ # steps:
206+ # - name: Download digests
207+ # uses: actions/download-artifact@v4
208+ # with:
209+ # path: ${{ runner.temp }}/digests
210+ # pattern: digests-docs-*
211+ # merge-multiple: true
212+
213+ # - name: Login to Docker Hub
214+ # uses: docker/login-action@v3
215+ # with:
216+ # username: ${{ secrets.DOCKERHUB_USERNAME }}
217+ # password: ${{ secrets.DOCKERHUB_TOKEN }}
218+
219+ # - name: Set up Docker Buildx
220+ # uses: docker/setup-buildx-action@v3
221+
222+ # - name: Docker meta
223+ # id: meta
224+ # uses: docker/metadata-action@v5
225+ # with:
226+ # images: ${{ env.DOCS_REPO }}
227+ # flavor: latest=false
228+ # tags: |
229+ # type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
230+ # type=semver,pattern={{major}}
231+ # type=semver,pattern={{major}}.{{minor}}
232+ # type=semver,pattern={{version}}
233+
234+ # - name: Create manifest list and push
235+ # working-directory: ${{ runner.temp }}/digests
236+ # run: |
237+ # docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
238+ # $(printf '${{ env.DOCS_REPO }}@sha256:%s ' *)
239+
240+ # - name: Inspect image
241+ # run: docker buildx imagetools inspect ${{ env.DOCS_REPO }}:${{ steps.meta.outputs.version }}
0 commit comments