From f1a473b362d3872667ddfb67ffc7b3f3f08eb0a9 Mon Sep 17 00:00:00 2001 From: dcsunny <934831065@qq.com> Date: Fri, 30 Jan 2026 11:35:52 +0800 Subject: [PATCH] =?UTF-8?q?chore(build):=20=E9=85=8D=E7=BD=AE=20Go=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=90=86=E5=B9=B6=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 Dockerfile 中设置默认 GOPROXY 为阿里云镜像 - 在 Makefile 中配置 GOPROXY 环境变量 - 移除 .gitea/workflows 目录下的所有 CI/CD 工作流文件 - 删除 release-nightly.yml 工作流配置 - 删除 release-tag.yml 工作流配置 - 删除 test.yml 工作流配置 --- .gitea/workflows/release-nightly.yml | 85 -------------------- .gitea/workflows/release-tag.yml | 111 --------------------------- .gitea/workflows/test.yml | 20 ----- Dockerfile | 2 +- Makefile | 2 + 5 files changed, 3 insertions(+), 217 deletions(-) delete mode 100644 .gitea/workflows/release-nightly.yml delete mode 100644 .gitea/workflows/release-tag.yml delete mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/release-nightly.yml b/.gitea/workflows/release-nightly.yml deleted file mode 100644 index 71420ed..0000000 --- a/.gitea/workflows/release-nightly.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -name: release-nightly - -on: - workflow_dispatch: - push: - branches: - - 'main' - tags: - - '*' - -env: - DOCKER_ORG: gitea - DOCKER_LATEST: nightly - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - name: goreleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser-pro - args: release --nightly - env: - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - S3_REGION: ${{ secrets.AWS_REGION }} - S3_BUCKET: ${{ secrets.AWS_BUCKET }} - GORELEASER_FORCE_TOKEN: "gitea" - GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - release-image: - runs-on: ubuntu-latest - strategy: - matrix: - variant: - - target: basic - tag_suffix: "" - - target: dind - tag_suffix: "-dind" - - target: dind-rootless - tag_suffix: "-dind-rootless" - - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - fetch-depth: 0 # all history for all branches and tags - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker BuildX - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Echo the tag - run: echo "${{ env.DOCKER_ORG }}/act_runner:nightly${{ matrix.variant.tag_suffix }}" - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - target: ${{ matrix.variant.target }} - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_ORG }}/act_runner:nightly${{ matrix.variant.tag_suffix }} diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml deleted file mode 100644 index 7735f7e..0000000 --- a/.gitea/workflows/release-tag.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: release-tag - -on: - push: - tags: - - "*" - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # all history for all branches and tags - - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} - fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0 - - name: goreleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser-pro - args: release - env: - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - S3_REGION: ${{ secrets.AWS_REGION }} - S3_BUCKET: ${{ secrets.AWS_BUCKET }} - GORELEASER_FORCE_TOKEN: "gitea" - GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - release-image: - runs-on: ubuntu-latest - container: - image: catthehacker/ubuntu:act-latest - env: - DOCKER_ORG: gitea - DOCKER_LATEST: latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # all history for all branches and tags - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker BuildX - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Get Meta - id: meta - run: | - echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT - echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - target: basic - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} - - - name: Build and push dind - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - target: dind - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-dind - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}-dind - - - name: Build and push dind-rootless - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - target: dind-rootless - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-dind-rootless - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}-dind-rootless diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml deleted file mode 100644 index 1a15bd9..0000000 --- a/.gitea/workflows/test.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: checks -on: - - push - - pull_request - -jobs: - lint: - name: check and test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - - name: vet checks - run: make vet - - name: build - run: make build - - name: test - run: make test diff --git a/Dockerfile b/Dockerfile index 40e2d66..74c5980 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ FROM golang:1.24-alpine AS builder RUN apk add --no-cache make git ARG GOPROXY -ENV GOPROXY=${GOPROXY:-} +ENV GOPROXY=${GOPROXY:-https://mirrors.aliyun.com/goproxy/,direct} COPY . /opt/src/act_runner WORKDIR /opt/src/act_runner diff --git a/Makefile b/Makefile index 448fb10..0bc43b4 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG) DOCKER_ROOTLESS_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)-dind-rootless GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 +GOPROXY ?= https://mirrors.aliyun.com/goproxy/,direct +export GOPROXY ifneq ($(shell uname), Darwin) EXTLDFLAGS = -extldflags "-static" $(null)