Merge pull request #71 from iflytek/feat/statedriven&reconciler #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |