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