|
3 | 3 | on: |
4 | 4 | schedule: |
5 | 5 | # https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07 |
6 | | - # This is meant to run at 13:17 on 11th of every month |
| 6 | + # This is meant to run at 13:17 UTC on 11th and 26th of every month |
7 | 7 | - cron: '17 13 11 * *' |
| 8 | + - cron: '17 13 26 * *' |
8 | 9 | push: |
9 | 10 | branches: |
10 | 11 | - main |
|
17 | 18 | env: |
18 | 19 | REGISTRY_IMAGE_BUILD: libfn/ci-build |
19 | 20 | REGISTRY_IMAGE_PRE_COMMIT: libfn/ci-pre-commit |
| 21 | + REGISTRY_IMAGE_DOCS: libfn/ci-docs |
20 | 22 |
|
21 | 23 | jobs: |
22 | 24 |
|
@@ -251,3 +253,108 @@ jobs: |
251 | 253 | - name: Inspect image |
252 | 254 | run: | |
253 | 255 | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE_PRE_COMMIT }}:${{ steps.meta.outputs.version }} |
| 256 | +
|
| 257 | + docs: |
| 258 | + runs-on: ubuntu-latest |
| 259 | + strategy: |
| 260 | + fail-fast: false |
| 261 | + matrix: |
| 262 | + platform: |
| 263 | + - linux/amd64 |
| 264 | + - linux/arm64 |
| 265 | + |
| 266 | + steps: |
| 267 | + - name: Prepare |
| 268 | + run: | |
| 269 | + platform=${{ matrix.platform }} |
| 270 | + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV |
| 271 | +
|
| 272 | + - name: Docker meta |
| 273 | + id: meta |
| 274 | + uses: docker/metadata-action@v5 |
| 275 | + with: |
| 276 | + images: ${{ env.REGISTRY_IMAGE_DOCS }} |
| 277 | + tags: | |
| 278 | + type=schedule,pattern={{date 'YYYYMMDD'}} |
| 279 | + type=raw,value=latest,enable={{is_default_branch}} |
| 280 | + type=sha |
| 281 | +
|
| 282 | + - name: Set up QEMU |
| 283 | + uses: docker/setup-qemu-action@v3 |
| 284 | + |
| 285 | + - name: Set up Docker Buildx |
| 286 | + uses: docker/setup-buildx-action@v3 |
| 287 | + |
| 288 | + - name: Login to Docker Hub |
| 289 | + uses: docker/login-action@v3 |
| 290 | + with: |
| 291 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 292 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 293 | + |
| 294 | + - name: Build and push by digest |
| 295 | + id: build |
| 296 | + uses: docker/build-push-action@v6 |
| 297 | + with: |
| 298 | + platforms: ${{ matrix.platform }} |
| 299 | + context: "{{defaultContext}}:ci/docs/" |
| 300 | + file: Dockerfile |
| 301 | + labels: ${{ steps.meta.outputs.labels }} |
| 302 | + outputs: type=image,name=${{ env.REGISTRY_IMAGE_DOCS }},push-by-digest=true,name-canonical=true,push=true |
| 303 | + sbom: true |
| 304 | + provenance: mode=max |
| 305 | + |
| 306 | + - name: Export digest |
| 307 | + run: | |
| 308 | + mkdir -p /tmp/digests |
| 309 | + digest="${{ steps.build.outputs.digest }}" |
| 310 | + touch "/tmp/digests/${digest#sha256:}" |
| 311 | +
|
| 312 | + - name: Upload digest |
| 313 | + uses: actions/upload-artifact@v4 |
| 314 | + with: |
| 315 | + name: digests-docs-${{ env.PLATFORM_PAIR }} |
| 316 | + path: /tmp/digests/* |
| 317 | + if-no-files-found: error |
| 318 | + retention-days: 1 |
| 319 | + |
| 320 | + merge-docs: |
| 321 | + runs-on: ubuntu-latest |
| 322 | + needs: |
| 323 | + - docs |
| 324 | + |
| 325 | + steps: |
| 326 | + - name: Download digests |
| 327 | + uses: actions/download-artifact@v4 |
| 328 | + with: |
| 329 | + path: /tmp/digests |
| 330 | + pattern: digests-docs-* |
| 331 | + merge-multiple: true |
| 332 | + |
| 333 | + - name: Set up Docker Buildx |
| 334 | + uses: docker/setup-buildx-action@v3 |
| 335 | + |
| 336 | + - name: Docker meta |
| 337 | + id: meta |
| 338 | + uses: docker/metadata-action@v5 |
| 339 | + with: |
| 340 | + images: ${{ env.REGISTRY_IMAGE_DOCS }} |
| 341 | + tags: | |
| 342 | + type=schedule,pattern={{date 'YYYYMMDD'}} |
| 343 | + type=raw,value=latest,enable={{is_default_branch}} |
| 344 | + type=sha |
| 345 | +
|
| 346 | + - name: Login to Docker Hub |
| 347 | + uses: docker/login-action@v3 |
| 348 | + with: |
| 349 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 350 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 351 | + |
| 352 | + - name: Create manifest list and push |
| 353 | + working-directory: /tmp/digests |
| 354 | + run: | |
| 355 | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
| 356 | + $(printf '${{ env.REGISTRY_IMAGE_DOCS }}@sha256:%s ' *) |
| 357 | +
|
| 358 | + - name: Inspect image |
| 359 | + run: | |
| 360 | + docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE_DOCS }}:${{ steps.meta.outputs.version }} |
0 commit comments