|
| 1 | +name: Dispatch Renderless Theme Runtime |
| 2 | +run-name: Dispatch Renderless Theme Runtime--${{ inputs.components }} |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + components: |
| 8 | + description: | |
| 9 | + 输入需要打包的模块名称,多个以英文逗号分隔, |
| 10 | + 例如: `theme,renderless,runtime` |
| 11 | + required: true |
| 12 | + type: string |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.sha }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: windows-latest |
| 20 | + steps: |
| 21 | + - name: Parse Components |
| 22 | + id: parseComponents |
| 23 | + uses: actions/github-script@v6 |
| 24 | + with: |
| 25 | + script: | |
| 26 | + const branchName = `${{ github.ref_name }}` |
| 27 | + const moduleName = `${{ inputs.components }}` |
| 28 | +
|
| 29 | + if (!moduleName.includes('theme') && !moduleName.includes('renderless') && !moduleName.includes('runtime')) { |
| 30 | + throw new Error('请输入正确的包名称') |
| 31 | + } |
| 32 | +
|
| 33 | + if (!branchName.includes('release-3.')) { |
| 34 | + throw new Error('请使用release-3.xx.xx分支发布正式包') |
| 35 | + } |
| 36 | +
|
| 37 | + - name: CheckOut Code |
| 38 | + uses: actions/checkout@master |
| 39 | + with: |
| 40 | + ref: ${{ github.ref_name }} |
| 41 | + |
| 42 | + - name: Setup pnpm |
| 43 | + uses: pnpm/action-setup@v2 |
| 44 | + |
| 45 | + - name: Setup Node |
| 46 | + uses: actions/setup-node@v3 |
| 47 | + with: |
| 48 | + node-version: 20.10.0 |
| 49 | + registry-url: 'https://registry.npmjs.org' |
| 50 | + |
| 51 | + - name: Get pnpm store directory |
| 52 | + id: pnpm-cache |
| 53 | + run: | |
| 54 | + echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 55 | +
|
| 56 | + - uses: actions/cache@v3 |
| 57 | + name: Setup pnpm cache |
| 58 | + with: |
| 59 | + path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} |
| 60 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-pnpm-store- |
| 63 | +
|
| 64 | + - name: Install dependencies |
| 65 | + run: pnpm i --no-frozen-lockfile |
| 66 | + |
| 67 | + - name: Run Build Theme |
| 68 | + if: contains(inputs.components, 'theme') == true |
| 69 | + run: pnpm build:theme |
| 70 | + |
| 71 | + - name: Run Build Renderless |
| 72 | + if: contains(inputs.components, 'renderless') == true |
| 73 | + run: pnpm build:renderless |
| 74 | + |
| 75 | + - name: Run Build ThemeSaas |
| 76 | + if: contains(inputs.components, 'theme-saas') == true |
| 77 | + run: pnpm build:themeSaas |
| 78 | + |
| 79 | + - name: Run Build ThemeMobile |
| 80 | + if: contains(inputs.components, 'theme-mobile') == true |
| 81 | + run: pnpm build:themeMobile |
| 82 | + |
| 83 | + - name: Run Build Runtime |
| 84 | + if: contains(inputs.components, 'runtime') == true |
| 85 | + run: pnpm build:runtime |
| 86 | + |
| 87 | + - name: Run Release alpha |
| 88 | + run: pnpm release:alpha |
| 89 | + |
| 90 | + - name: Publish |
| 91 | + run: | |
| 92 | + pnpm pub:all |
| 93 | + env: |
| 94 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }} |
0 commit comments