mirror of
https://github.com/cnrancher/kube-explorer.git
synced 2025-04-27 11:00:48 +00:00
fix: aliyun-metadata should have registry name for image
This commit is contained in:
parent
4d17a53d3e
commit
1633838017
14
.github/workflows/push.yaml
vendored
14
.github/workflows/push.yaml
vendored
@ -8,6 +8,9 @@ on:
|
||||
tags:
|
||||
- "v*.*.*" # Matches any tag that starts with 'v' and follows semantic versioning
|
||||
|
||||
env:
|
||||
ALIYUN_REGISTRY: ${{ vars.ALIYUN_REGISTRY || '' }}
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
@ -18,36 +21,35 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: CI
|
||||
env:
|
||||
CROSS: push
|
||||
SKIP_PACKAGE: "true"
|
||||
run: make ci
|
||||
- name: Prepare for packaging image
|
||||
run: cp dist/* package/
|
||||
# aliyun image to test the docker build is ok
|
||||
- name: Login to Aliyun ACR
|
||||
if: ${{ vars.ALIYUN_REGISTRY != '' }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-shenzhen.aliyuncs.com
|
||||
registry: ${{ env.ALIYUN_REGISTRY }}
|
||||
username: ${{ secrets.ACR_USERNAME }}
|
||||
password: ${{ secrets.ACR_TOKEN }}
|
||||
if: ${{ vars.ALIYUN == 'true' }}
|
||||
- name: Aliyun image docker meta
|
||||
if: ${{ vars.ALIYUN == 'true' }}
|
||||
if: ${{ vars.ALIYUN_REGISTRY != '' }}
|
||||
id: aliyun-meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ vars.REPO || 'cnrancher' }}/${{ vars.IMAGE || 'kube-explorer' }}
|
||||
images: ${{ env.ALIYUN_REGISTRY }}/${{ vars.REPO || 'cnrancher' }}/${{ vars.IMAGE || 'kube-explorer' }}
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=ref,event=branch,suffix=-head
|
||||
- name: Build to Aliyun
|
||||
if: ${{ vars.ALIYUN_REGISTRY != '' }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
labels: ${{ steps.aliyun-meta.outputs.labels }}
|
||||
tags: "${{ steps.aliyun-meta.outputs.tags }}"
|
||||
context: package
|
||||
push: true
|
||||
if: ${{ vars.ALIYUN == 'true' }}
|
||||
|
||||
# docker hub multi-arch image
|
||||
- name: Login to Dockerhub
|
||||
|
@ -44,6 +44,7 @@ builds:
|
||||
- CGO_ENABLED=0
|
||||
targets:
|
||||
- "linux_amd64"
|
||||
- "linux_arm64"
|
||||
flags:
|
||||
- -tags=embed
|
||||
binary: '{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}'
|
||||
|
@ -7,11 +7,23 @@ cd "$(dirname $0)/.."
|
||||
rm -rf ./bin/* ./dist/*
|
||||
|
||||
BUILD_TARGET="${BUILD_TARGET:-dev}"
|
||||
CROSS=${CROSS:-}
|
||||
|
||||
if [ -n "$CROSS" ]; then
|
||||
BUILD_TARGET="prod"
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
CROSS=tag
|
||||
fi
|
||||
|
||||
case "$CROSS" in
|
||||
"tag")
|
||||
BUILD_TARGET="prod"
|
||||
;;
|
||||
"push")
|
||||
;;
|
||||
*)
|
||||
BUILD_ARG="${BUILD_ARG} --single-target"
|
||||
;;
|
||||
esac
|
||||
|
||||
BUILD_ARG="${BUILD_ARG:-} --skip validate --id ${BUILD_TARGET}"
|
||||
|
||||
mkdir -p "./bin"
|
||||
|
Loading…
Reference in New Issue
Block a user