Skip to content

🍰 Release

🍰 Release #51

Workflow file for this run

name: 🍰 Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
release-docker-compose:
description: 'docker compose'
type: boolean
default: false
release-helm-chart:
description: 'helm chart'
type: boolean
default: false
release-install-script:
description: 'install script'
type: boolean
default: false
release-sql:
description: 'sql'
type: boolean
default: false
version:
description: 'version(eg: v0.0.1)'
required: true
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
release_type: ${{ steps.release-type.outputs.value }}
version: ${{ steps.version.outputs.version }}
steps:
- name: default Checkout
uses: actions/checkout@v4
- name: Version tag
id: version
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
version=${{ github.event.inputs.version }}
echo "version=${version#v}" >> $GITHUB_OUTPUT
fi
- name: 🚚 Get release type
id: release-type
run: |
if [[ ${{ steps.version.outputs.version }} =~ -(alpha|beta|rc)\. ]]; then
extracted_type="${BASH_REMATCH[1]}"
echo "value=$extracted_type" >> $GITHUB_OUTPUT
else
echo "value=stable" >> $GITHUB_OUTPUT
fi
- name: Print Workflow Info
run: |
echo "trigger: ${{ github.event_name }}"
echo "version: ${{ steps.version.outputs.version }}"
echo "release type: ${{ steps.release-type.outputs.value }}"
echo "release-docker-compose: ${{ github.event.inputs.release-docker-compose }}"
echo "release-helm-chart: ${{ github.event.inputs.release-helm-chart }}"
echo "release-install-script: ${{ github.event.inputs.release-install-script }}"
echo "release-sql: ${{ github.event.inputs.release-sql }}"
release-docker-compose:
name: Release docker compose
runs-on: ubuntu-latest
needs: [prepare]
if: ${{github.event_name == 'push' || github.event.inputs.release-docker-compose }}
steps:
- name: default Checkout
uses: actions/checkout@v4
- name: tar docker-compose.tar.gz
run: |
cd docker-compose
tar -czvf ~/docker-compose.tar.gz * .[!.]*
- name: Sync universer.tar.gz to OSS (latest)
uses: hexf00/upload-to-oss@v1
with:
source: '~/docker-compose.tar.gz'
dest: 'releases/latest/universer-latest-docker-compose.tar.gz'
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
if: ${{ needs.prepare.outputs.release_type == 'stable' }}
- name: Sync docker-compose-v${{ needs.prepare.outputs.version }}.tar.gz to OSS
uses: hexf00/upload-to-oss@v1
with:
source: '~/docker-compose.tar.gz'
dest: 'releases/v${{ needs.prepare.outputs.version }}/universer-v${{ needs.prepare.outputs.version }}-docker-compose.tar.gz'
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
release-install-script:
name: Release install script
runs-on: ubuntu-latest
needs: [prepare]
if: ${{ (github.event_name == 'push' || github.event.inputs.release-install-script) && needs.prepare.outputs.release_type == 'stable' }}
steps:
- name: Release install.sh
uses: hexf00/upload-to-oss@v1
with:
source: 'install.sh'
dest: tool/install.sh
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
- name: Release get-docker/get-docker-official-script.sh
uses: hexf00/upload-to-oss@v1
with:
source: 'get-docker/get-docker-official-script.sh'
dest: tool/get-docker-official-script.sh
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
- name: Release get-docker/get-docker.sh
uses: hexf00/upload-to-oss@v1
with:
source: 'get-docker/get-docker.sh'
dest: tool/get-docker.sh
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
release-helm-chart:
name: Release helm chart
runs-on: ubuntu-latest
needs: [prepare]
if: ${{ (github.event_name == 'push' || github.event.inputs.release-helm-chart) && needs.prepare.outputs.release_type == 'stable' }}
steps:
- name: default Checkout
uses: actions/checkout@v4
- name: Login to Aliyun Container Registry (ACR)
uses: aliyun/acr-login@v1
with:
login-server: univer-acr-registry.cn-shenzhen.cr.aliyuncs.com
region-id: cn-shenzhen
username: "${{ secrets.REGISTRY_USERNAME }}"
password: "${{ secrets.REGISTRY_PASSWORD }}"
- name: Sync helm chart to oci
run: |
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo update
make all
update-sql:
name: Sync sql to oss
runs-on: ubuntu-latest
needs: [prepare]
if: ${{ github.event_name == 'push' || github.event.inputs.release-sql }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: dream-num/container-images
path: container-images
token: ${{ secrets.GH_TOKEN }}
- name: tar sql.tar.gz
run: |
mkdir -p /tmp/sql
cp container-images/universer-sql/postgresql/sql/universer_schema.sql /tmp/sql/postgresql.sql
cp container-images/universer-sql/mysql/sql/univer.sql /tmp/sql/mysql.sql
cp container-images/universer-sql/gaussdb/sql/universer_schema.sql /tmp/sql/gaussdb.sql
cp container-images/universer-sql/dameng/sql/universer_schema.sql /tmp/sql/dameng.sql
cp -r temporal-sql /tmp/sql
cd /tmp/sql
tar -czvf univer-sql.tar.gz *
- name: Sync univer-sql.tar.gz to OSS (latest)
uses: hexf00/upload-to-oss@v1
with:
source: '/tmp/sql/univer-sql.tar.gz'
dest: 'releases/latest/universer-sql-latest.tar.gz'
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
if: ${{ needs.prepare.outputs.release_type == 'stable' }}
- name: Sync univer-sql.tar.gz to OSS
uses: hexf00/upload-to-oss@v1
with:
source: '/tmp/sql/univer-sql.tar.gz'
dest: 'releases/v${{ needs.prepare.outputs.version }}/universer-sql-v${{ needs.prepare.outputs.version }}.tar.gz'
bucket: ${{secrets.OSS_BUCKET}}
region: "oss-cn-shenzhen"
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}