Skip to content

⚓ Push

⚓ Push #289

name: 📤 Deploy
on:
workflow_dispatch:
inputs:
image-tag:
description: The image tag to deploy (optional, if not provided, the image will be built first)
type: string
default: ''
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{github.event}}
cancel-in-progress: true
jobs:
build:
if: inputs.image-tag == ''
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- name: Set IMAGE_TAG environment variable
run: echo "IMAGE_TAG=$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_ENV
- name: Login to Aliyun Container Registry (ACR)
uses: aliyun/acr-login@v1
with:
login-server: '${{ secrets.REGISTRY_CR }}'
region-id: cn-shenzhen
username: '${{ secrets.REGISTRY_USERNAME }}'
password: '${{ secrets.REGISTRY_PASSWORD }}'
- name: check check_image
run: |
echo "IMAGE_EXIST=$(make check_image CR=${{ secrets.REGISTRY_CR }})" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: ${{ secrets.REGISTRY_CR }}/devops/binfmt:qemu-v7.0.0
if: env.IMAGE_EXIST != 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: buildx
with:
driver-opts: |
image=${{ secrets.REGISTRY_CR }}/devops/buildkit:buildx-stable-1
if: env.IMAGE_EXIST != 'true'
- name: Build and Push Docker Image
run: |
IMAGE_TAG=$(echo "${{ github.sha }}" | cut -c 1-7)
cd packages/www
make push_image PUSH_TAG=$IMAGE_TAG BUILDER=${{ steps.buildx.outputs.name }} CR=${{ secrets.REGISTRY_CR }}
if: env.IMAGE_EXIST != 'true'
deploy:
if: inputs.image-tag == ''
runs-on: ubuntu-latest
needs: build
timeout-minutes: 10
steps:
- name: Set IMAGE_TAG environment variable
run: echo "IMAGE_TAG=$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_ENV
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: dream-num/helm-chart-private
event-type: dispatch
client-payload: '{"service":"univer-site","tag":"${{ env.IMAGE_TAG }}"}'
deploy-trigger:
if: inputs.image-tag != ''
runs-on: arc-runner-set
steps:
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: dream-num/helm-chart-private
event-type: dispatch
client-payload: '{"service":"univer-site","tag":"${{ inputs.image-tag }}"}'