From 23804d71c59affea2d03d43bff4ec02505e69303 Mon Sep 17 00:00:00 2001 From: "Tomi P. Hakala" Date: Thu, 16 Jan 2025 08:13:22 +0200 Subject: [PATCH] chore: enhance nightly build workflow with Docker support - Added a new job for building and pushing Docker images to GitHub Container Registry. - Configured the workflow to run on multiple platforms (linux/amd64 and linux/arm64) for broader compatibility. - Implemented steps for checking out code, setting up Docker Buildx, logging into the GitHub Container Registry, and generating metadata for Docker images. - Updated the Docker actions to their latest versions for improved reliability and security. These changes improve the nightly build process by integrating Docker image management, ensuring a more robust and efficient workflow. --- .github/workflows/nightly-build.yml | 44 ++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index ac0ae39..66ad73a 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -109,4 +109,46 @@ jobs: delete_tags: true delete_tag_pattern: ^nightly- env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + docker: + runs-on: ubuntu-22.04 + needs: nightly + strategy: + matrix: + platform: [linux/amd64, linux/arm64] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate downcase repository name + run: | + echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ env.REPO }} + tags: | + type=raw,value=nightly + type=raw,value=nightly-{{date 'YYYYMMDD'}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file