Merge pull request #1018 from Abirdcfly/fixworker #566
This file contains 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: Build KubeAGI arcadia image | |
on: | |
push: | |
branches: [main] | |
tags: | |
- 'v*' | |
env: | |
GO_VER: 1.21 | |
GO_TAGS: "" | |
GOPROXY: https://proxy.golang.org/,direct | |
jobs: | |
image: | |
if: github.repository == 'kubeagi/arcadia' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Variable | |
id: set-env | |
run: | | |
TAG=$(git describe --tags --abbrev=0 --match 'v*' 2> /dev/null) || true | |
if [ -z "$TAG" ]; then | |
echo "No tag found, use v0.1.0 as default" | |
TAG=v0.1.0 | |
fi | |
echo "TAG=${TAG}" >> $GITHUB_OUTPUT | |
echo "DATE=$(TZ=Asia/Shanghai date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Show Variable | |
run: echo "varibables ${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
buildkitd-flags: --debug | |
config-inline: | | |
[worker.oci] | |
max-parallelism = 1 | |
- name: Login to the dockerhub Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- uses: benjlevesque/[email protected] | |
name: Get short commit sha | |
id: short-sha | |
- name: Set extra image tags | |
id: set-release-tags | |
run: | | |
if [[ $GITHUB_REF =~ ^refs/tags/v.* ]]; then | |
echo "ARCADIA_RLEASE_TAG=kubeagi/arcadia:$TAG" >> "$GITHUB_OUTPUT" | |
echo "DATA-PPRCESSING_RLEASE_TAG=kubeagi/data-processing:$TAG" >> "$GITHUB_OUTPUT" | |
fi | |
env: | |
TAG: ${{ steps.set-env.outputs.TAG }} | |
- name: Build and push | |
id: push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
kubeagi/arcadia:latest | |
kubeagi/arcadia:v${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }} | |
kubeagi/arcadia:${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }} | |
${{ steps.set-release-tags.outputs.ARCADIA_RLEASE_TAG }} | |
push: true | |
build-args: | | |
GO_VER=${{ env.GO_VER }} | |
GO_TAGS=${{ env.GO_TAGS }} | |
BUILD_ID=${{ env.SEMREV_LABEL }} | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
GOPROXY=${{ env.GOPROXY }} | |
- name: Build data processing image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./pypi/data-processing | |
file: ./pypi/data-processing/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
kubeagi/data-processing:latest | |
kubeagi/data-processing:v${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }} | |
kubeagi/data-processing:${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }} | |
${{ steps.set-env.outputs.DATA-PPRCESSING_RLEASE_TAG }} | |
push: true |