mirror of
https://github.com/cnrancher/kube-explorer.git
synced 2026-02-21 06:22:38 +00:00
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
name: Push to Master
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- release/v*
|
|
- main
|
|
- "release/v*"
|
|
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
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: CI
|
|
env:
|
|
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: ${{ env.ALIYUN_REGISTRY }}
|
|
username: ${{ secrets.ACR_USERNAME }}
|
|
password: ${{ secrets.ACR_TOKEN }}
|
|
- name: Aliyun image docker meta
|
|
if: ${{ vars.ALIYUN_REGISTRY != '' }}
|
|
id: aliyun-meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
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
|
|
|
|
# docker hub multi-arch image
|
|
- name: Login to Dockerhub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ vars.REPO || 'cnrancher' }}/${{ vars.IMAGE || 'kube-explorer' }}
|
|
tags: |
|
|
type=ref,event=tag
|
|
type=ref,event=branch,suffix=-head
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Build to Dockerhub
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: "${{ steps.meta.outputs.tags }}"
|
|
context: package
|
|
push: true
|
|
|
|
- name: Make release note
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
make release-note
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
files: dist/kube-explorer-*
|
|
body_path: dist/release-note
|
|
draft: true
|