feat: add ci version

This commit is contained in:
seepine 2024-08-16 12:01:15 +08:00
parent 3b085a9e01
commit d7c77b36b1
8 changed files with 22 additions and 10 deletions

View File

@ -68,6 +68,9 @@ inputs:
required: false required: false
description: '设置输出文件路径,默认为./output.txt' description: '设置输出文件路径,默认为./output.txt'
default: './output.txt' default: './output.txt'
ci-version:
required: false
description: 'ci版本'
runs: runs:
using: 'node16' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

View File

@ -33,7 +33,7 @@ export const preview = async (option: Preview): Promise<string> => {
} }
const command = [ const command = [
'npx', 'npx',
'miniprogram-ci', `miniprogram-ci@${option.ciVersion || '2.0.8'}`,
'preview', 'preview',
...getArgs(option), ...getArgs(option),
...previewArgs ...previewArgs

View File

@ -4,9 +4,12 @@ import {getArgs} from './utils'
import * as cp from 'child_process' import * as cp from 'child_process'
export const upload = async (option: Upload): Promise<void> => { export const upload = async (option: Upload): Promise<void> => {
const command = ['npx', 'miniprogram-ci', 'upload', ...getArgs(option)].join( const command = [
' ' 'npx',
) `miniprogram-ci@${option.ciVersion || '2.0.8'}`,
'upload',
...getArgs(option)
].join(' ')
core.info('Command:') core.info('Command:')
core.info(` ${command}`) core.info(` ${command}`)

View File

@ -9,7 +9,7 @@ export const preview = async (option: Preview): Promise<string> => {
cp.execSync( cp.execSync(
[ [
'npx', 'npx',
'tma', `tma@${option.ciVersion || '0.1.27'}`,
'set-app-config', 'set-app-config',
option.appid, option.appid,
'--token', '--token',
@ -19,7 +19,7 @@ export const preview = async (option: Preview): Promise<string> => {
const command = [ const command = [
'npx', 'npx',
'tma', `tma@${option.ciVersion || '0.1.27'}`,
'preview', 'preview',
...getArgs(option), ...getArgs(option),
'--qrcode-output', '--qrcode-output',

View File

@ -7,7 +7,7 @@ export const upload = async (option: Upload): Promise<void> => {
cp.execSync( cp.execSync(
[ [
'npx', 'npx',
'tma', `tma@${option.ciVersion || '0.1.27'}`,
'set-app-config', 'set-app-config',
option.appid, option.appid,
'--token', '--token',
@ -16,7 +16,7 @@ export const upload = async (option: Upload): Promise<void> => {
) )
const command = [ const command = [
'npx', 'npx',
'tma', `tma@${option.ciVersion || '0.1.27'}`,
'upload', 'upload',
...getArgs(option), ...getArgs(option),
option.projectPath option.projectPath

View File

@ -48,7 +48,9 @@ async function run(): Promise<void> {
version: getInput(Inputs.version) || '', version: getInput(Inputs.version) || '',
desc: getInput(Inputs.desc), desc: getInput(Inputs.desc),
robot: getInputAsInt(Inputs.robot), robot: getInputAsInt(Inputs.robot),
threads: getInputAsInt(Inputs.threads) threads: getInputAsInt(Inputs.threads),
ciVersion: getInput(Inputs.ciVersion)
} }
if (getInput(Inputs.mode) === 'test') { if (getInput(Inputs.mode) === 'test') {
isTest = true isTest = true

View File

@ -40,6 +40,8 @@ export type CiOption = {
desc?: string desc?: string
robot?: number robot?: number
threads?: number threads?: number
ciVersion?: string
} }
export type Upload = CiOption & {} export type Upload = CiOption & {}

View File

@ -19,7 +19,9 @@ export enum Inputs {
scene = 'scene', scene = 'scene',
// output // output
output = 'output', output = 'output',
outputPath = 'output-path' outputPath = 'output-path',
ciVersion = 'ci-version'
} }
export enum Outputs { export enum Outputs {