Skip to content

⚓ Push

⚓ Push #18

Workflow file for this run

name: ⚓ Push
on:
workflow_dispatch:
inputs:
version:
description: version(optional)
type: string
default:
ref:
type: string
default: dev
jobs:
build-binary:
name: BuildBinary
permissions:
id-token: write
contents: write
attestations: write
strategy:
fail-fast: true
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
repository: dream-num/univer-desktop
ref: ${{ inputs.ref }}
token: ${{ secrets.GH_TOKEN }}
submodules: true
- name: Setup pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Set version
id: set_version
shell: bash
run: |
if [ -z "${{ inputs.version }}" ]; then
cd app
APP_VERSION=$(node -e 'console.log(require("./package.json").version)')
COMMIT_HASH=$(git rev-parse --short=7 HEAD)
echo "version=${APP_VERSION}-dev.${COMMIT_HASH}" >> $GITHUB_OUTPUT
else
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
fi
- name: Determine version type
id: version_type
shell: bash
run: |
VERSION="${{ steps.set_version.outputs.version }}"
if [[ $VERSION == *"-dev"* ]]; then
echo "is_dev=true" >> $GITHUB_OUTPUT
echo "is_stable=false" >> $GITHUB_OUTPUT
elif [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "is_dev=false" >> $GITHUB_OUTPUT
echo "is_stable=true" >> $GITHUB_OUTPUT
else
echo "is_dev=false" >> $GITHUB_OUTPUT
echo "is_stable=false" >> $GITHUB_OUTPUT
fi
- name: init dest
id: init_dest
shell: bash
run: |
if [ ${{ steps.version_type.outputs.is_stable }} = true ]; then
echo "dest=univer-go/latest/" >> $GITHUB_OUTPUT
else
echo "dest=test/staging/" >> $GITHUB_OUTPUT
fi
- name: Print Release Info
shell: bash
run: |
echo "Version: ${{ steps.set_version.outputs.version }}"
echo "Is Dev: ${{ steps.version_type.outputs.is_dev }}"
echo "Is Stable: ${{ steps.version_type.outputs.is_stable }}"
echo "Dest: ${{ steps.init_dest.outputs.dest }}"
echo "RELEASE_CHANNEL=$(${{ steps.version_type.outputs.is_dev }} ? "development" : "production")"
- name: Install Python setuptools
if: matrix.os == 'macos-latest'
run: brew install python-setuptools
- name: Install appdmg
if: matrix.os == 'macos-latest'
run: pnpm add -g appdmg
- run: pnpm i
- run: |
cd app
pnpm version ${{ steps.set_version.outputs.version }} --allow-same-version --no-git-tag-version
- name: Make
shell: bash
run: |
RELEASE_CHANNEL=$(${{ steps.version_type.outputs.is_dev }} ? "development" : "production") pnpm make
- uses: hexf00/upload-to-oss@v2
with:
files: |
app/out/make/**/*.dmg
app/out/make/**/*.zip
app/out/make/**/*.exe
app/out/make/**/*.AppImage
app/out/make/**/*.yml
dest: ${{ steps.init_dest.outputs.dest }}
bucket: release-univer
region: oss-cn-shenzhen
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
timeout: 1200s
- uses: hexf00/upload-to-oss@v2
if: ${{ steps.version_type.outputs.is_stable || steps.version_type.outputs.is_dev }}
continue-on-error: true
with:
files: |
app/out/make/**/*.yml
dest: ${{ steps.init_dest.outputs.dest }}
bucket: release-univer
region: oss-cn-shenzhen
accessKeyId: ${{secrets.S3_ACCESS_KEY_ID}}
accessKeySecret: ${{secrets.S3_ACCESS_KEY_SECRET}}
timeout: 1200s
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-nightly
path: |
app/out/make/**/*.zip
app/out/make/**/*.exe
app/out/make/**/*.AppImage
app/out/make/**/*.yml
app/out/make/**/*.dmg
retention-days: 7
- name: Create Dev Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.set_version.outputs.version }}
draft: false
prerelease: ${{ !steps.version_type.outputs.is_stable }}
tag_name: ${{ steps.set_version.outputs.version }}
files: |
app/out/make/**/*.dmg
app/out/make/**/*.zip
app/out/make/**/*.exe
app/out/make/**/*.AppImage
app/out/make/**/*.yml
body: |
This is an automated nightly release for testing purposes.
Version: ${{ steps.set_version.outputs.version }}
**Warning:** This build may be unstable and is not recommended for production use.