From 0db3a0c14012293044a4bae49d87d2bb642ad0bc Mon Sep 17 00:00:00 2001 From: sledro Date: Tue, 9 Sep 2025 20:22:49 +0100 Subject: [PATCH 1/3] Add Docker build workflow for image release This commit introduces a new GitHub Actions workflow to automate the building and publishing of Docker images. The workflow triggers on pushes to the main branch and on tags, extracting the version from the Git reference. It supports multi-platform builds for both amd64 and arm64 architectures, ensuring efficient image management and deployment. --- .github/workflows/docker_build.yml | 92 ++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/docker_build.yml diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 000000000..ac4a48536 --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,92 @@ +name: Docker Build Release + +on: + push: + branches: + - lightlink # Trigger the workflow on pushes to the main branch + tags: + - "**" # Trigger the workflow on tags including hierarchical tags like v1.0/beta + pull_request: + types: [opened, synchronize] # Trigger the workflow when a PR is opened or updated + +jobs: + extract-version: + name: Extract version + runs-on: warp-ubuntu-latest-x64-16x + outputs: + VERSION: ${{ steps.extract_version.outputs.VERSION }} + steps: + - name: Extract version + id: extract_version + run: | + if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then + VERSION="${GITHUB_REF#refs/tags/}" + else + VERSION="$(echo ${GITHUB_SHA} | cut -c1-7)" + fi + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + + echo "| | |" >> $GITHUB_STEP_SUMMARY + echo "| ------------------- | ---------------------- |" >> $GITHUB_STEP_SUMMARY + echo "| \`GITHUB_REF_TYPE\` | \`${GITHUB_REF_TYPE}\` |" >> $GITHUB_STEP_SUMMARY + echo "| \`GITHUB_REF_NAME\` | \`${GITHUB_REF_NAME}\` |" >> $GITHUB_STEP_SUMMARY + echo "| \`GITHUB_REF\` | \`${GITHUB_REF}\` |" >> $GITHUB_STEP_SUMMARY + echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY + echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY + + build-docker: + name: Build and publish Docker image + needs: extract-version + runs-on: ${{ matrix.configs.runner }} + env: + VERSION: ${{ needs.extract-version.outputs.VERSION }} + permissions: + contents: read + packages: write + strategy: + matrix: + configs: + - target: linux/amd64 + runner: warp-ubuntu-latest-x64-16x + - target: linux/arm64 + runner: warp-ubuntu-latest-arm64-16x + steps: + - name: checkout sources + uses: actions/checkout@v4 + + - name: docker qemu + uses: docker/setup-qemu-action@v3 + + - name: docker buildx + uses: docker/setup-buildx-action@v3 + + - name: docker metadata + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/${{ github.repository }} + labels: org.opencontainers.image.source=${{ github.repositoryUrl }} + tags: | + type=sha + type=schedule,pattern=nightly + + - name: docker login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: docker build and push op-rbuilder + uses: docker/build-push-action@v5 + with: + cache-from: type=gha + cache-to: type=gha,mode=max + file: Dockerfile + context: . + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ matrix.configs.target }} + push: true + tags: ${{ steps.meta.outputs.tags }} + build-args: | + RBUILDER_BIN=op-rbuilder From 42954796b6e1316268cd05f7720283cebad46363 Mon Sep 17 00:00:00 2001 From: sledro Date: Tue, 9 Sep 2025 20:38:13 +0100 Subject: [PATCH 2/3] Update Docker build workflow to use ubuntu-latest runner --- .github/workflows/docker_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index ac4a48536..120508f46 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -12,7 +12,7 @@ on: jobs: extract-version: name: Extract version - runs-on: warp-ubuntu-latest-x64-16x + runs-on: ubuntu-latest outputs: VERSION: ${{ steps.extract_version.outputs.VERSION }} steps: From e5999e32f0c3bcc0af6b957c463dc202edadb109 Mon Sep 17 00:00:00 2001 From: sledro Date: Tue, 9 Sep 2025 20:41:37 +0100 Subject: [PATCH 3/3] Refactor Docker build workflow to simplify runner configuration by using ubuntu-latest for all targets --- .github/workflows/docker_build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 120508f46..63be92c2c 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -47,9 +47,7 @@ jobs: matrix: configs: - target: linux/amd64 - runner: warp-ubuntu-latest-x64-16x - - target: linux/arm64 - runner: warp-ubuntu-latest-arm64-16x + runner: ubuntu-latest steps: - name: checkout sources uses: actions/checkout@v4