mirror of
https://github.com/woodchen-ink/Oapi-Feishu.git
synced 2025-07-18 05:42:08 +08:00
61 lines
1.4 KiB
YAML
61 lines
1.4 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- v*
|
|
|
|
env:
|
|
IMAGE_NAME: oapi-feishu
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.23' # 使用你项目需要的 Go 版本
|
|
|
|
- name: Build for amd64
|
|
run: |
|
|
cd code
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-w -s' -o ../feishu_chatgpt-amd64
|
|
|
|
- name: Build for arm64
|
|
run: |
|
|
cd code
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags '-w -s' -o ../feishu_chatgpt-arm64
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
use: true
|
|
driver-opts: image=moby/buildkit:latest
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: woodchen
|
|
password: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: Dockerfile.multi
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
woodchen/${{ env.IMAGE_NAME }}:latest
|
|
woodchen/${{ env.IMAGE_NAME }}:${{ github.sha }}
|