Skip to content

Merge pull request #69 from iflytek/feat/statedriven&reconciler #28

Merge pull request #69 from iflytek/feat/statedriven&reconciler

Merge pull request #69 from iflytek/feat/statedriven&reconciler #28

Workflow file for this run

name: Continuous Integration
# Trigger the workflow on push events to the main branch.
on:
push:
branches: [ "main" ]
# Build and publish a multi-architecture Docker image to GHCR.
jobs:
build:
# Run on the latest Ubuntu environment.
runs-on: ubuntu-latest
# Grant permissions to write packages (Docker images) to GHCR.
permissions:
packages: write
contents: read
steps:
# Step 1: Checkout source code from the repository.
- name: Checkout Source Code
uses: actions/checkout@v4
# Step 2: Set up Go environment with the specified version.
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
# Step 3: Install Make if not present (required for build automation).
- name: Install Make
run: |
sudo apt-get update
sudo apt-get install -y make
# Step 4: Set up Docker Buildx for multi-architecture image building.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Step 5: Log in to GitHub Container Registry (GHCR).
# Credentials use the built-in GITHUB_TOKEN for secure authentication.
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Step 6: Build the Go binary using Make.
# Assumes a Makefile with a 'build' target that runs 'go build'.
- name: Build Binary
run: make build
# Step 7: Build and push a multi-architecture Docker image.
# Supports linux/amd64 and linux/arm64 by default.
# Image is tagged with the Git commit SHA for traceability.
- name: Build and Push Multi-Architecture Docker Image
env:
IMAGE_REPO: ghcr.io/${{ github.repository }}
IMAGE_TAG: ${{ github.sha }}
run: |
make docker-multiarch