Skip to content

fix(executor): surface real first-provider error on catch-all fallthr… #134

fix(executor): surface real first-provider error on catch-all fallthr…

fix(executor): surface real first-provider error on catch-all fallthr… #134

Workflow file for this run

name: Docker Image CI
on:
push:
tags:
- "*"
# Allow fork/feature branches to publish images for deploy testing.
branches:
- "fix/**"
- "hotfix/**"
workflow_dispatch:
inputs:
tag:
description: "Image tag override (defaults to branch/ref name)"
required: false
type: string
workflow_call:
inputs:
tag:
required: true
type: string
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Set image name
id: image
env:
# Pass via env to avoid Actions template injection into the shell script.
RAW_TAG: ${{ inputs.tag || github.event.inputs.tag || github.ref_name }}
REF_NAME: ${{ github.ref_name }}
REGISTRY: ${{ env.REGISTRY }}
run: |
NAME="${GITHUB_REPOSITORY,,}"
echo "name=${NAME}" >> "$GITHUB_OUTPUT"
# workflow_call / workflow_dispatch may pass inputs.tag; otherwise use ref name.
# Sanitize branch names so tags are valid docker references.
RAW="$RAW_TAG"
TAG=$(echo "$RAW" | tr '[:upper:]' '[:lower:]' | sed 's#/#-#g' | sed 's/[^a-z0-9._-]/-/g')
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "raw=${RAW}" >> "$GITHUB_OUTPUT"
TAGS="${REGISTRY}/${NAME}:${TAG}"
# Only default-branch builds should retag :latest (not fix/** deploy probes).
if [ "$REF_NAME" = "main" ] || [ "$REF_NAME" = "master" ]; then
TAGS="${TAGS},${REGISTRY}/${NAME}:latest"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: web/package.json
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Build frontend
working-directory: web
env:
VITE_COMMIT: ${{ github.sha }}
run: |
pnpm install
pnpm build
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Cross-compile Go binaries
env:
VERSION: ${{ steps.image.outputs.tag }}
COMMIT: ${{ github.sha }}
BUILD_TIME: ${{ github.event.head_commit.timestamp }}
run: |
LDFLAGS="-s -w \
-X github.com/awsl-project/maxx/internal/version.Version=${VERSION} \
-X github.com/awsl-project/maxx/internal/version.Commit=${COMMIT} \
-X github.com/awsl-project/maxx/internal/version.BuildTime=${BUILD_TIME}"
# 交叉编译 AMD64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o maxx-linux-amd64 cmd/maxx/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o maxx-cli-linux-amd64 ./cmd/maxx-cli
# 交叉编译 ARM64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o maxx-linux-arm64 cmd/maxx/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o maxx-cli-linux-arm64 ./cmd/maxx-cli
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.ci
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: mode=max
sbom: true
tags: ${{ steps.image.outputs.tags }}