Skip to content

Commit

Permalink
ci(publish): add github action auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr committed Mar 28, 2024
1 parent 33f32ae commit 016aac5
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 41 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/auto-all-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Auto All Publish

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: windows-latest
outputs:
publishVersion: ${{ steps.parseTag.outputs.publishVersion }}
steps:
- name: CheckOut Code
uses: actions/checkout@master
with:
ref: dev

- name: Parse Tag
id: parseTag
uses: actions/github-script@v6
with:
script: |
const tag = `${{ github.ref_name }}`
const publishVersion = tag.slice(3)
core.setOutput('publishVersion', publishVersion)
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.10.0
registry-url: 'https://registry.npmjs.org'

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --no-frozen-lockfile

- name: Run Build Components
run: pnpm build:ui -t ${{ steps.parseTag.outputs.publishVersion }}

- name: Run Build Sass Common
run: pnpm build:ui saas-common -t ${{ steps.parseTag.outputs.publishVersion }} -d saas

- name: Run Build Runtime
run: pnpm build:runtime

- name: Run Build Theme
run: pnpm build:theme

- name: Run Build Renderless
run: pnpm build:renderless

- name: Run Build ThemeSaas
run: pnpm build:themeSaas

- name: Run Build ThemeMobile
run: pnpm build:themeMobile

- name: Publish Vue3 And Vue2 components
run: pnpm pub:all
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release
if: contains(github.ref_name, 'alpha') == false
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
41 changes: 0 additions & 41 deletions .github/workflows/auto-publish.yml

This file was deleted.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"pub3": "pnpm --filter=\"./packages/dist3/**\" publish --no-git-checks --access=public",
"pub2.7": "pnpm --filter=\"./packages/dist2.7/**\" publish --tag v2.7-latest --no-git-checks --access=public",
"pub:aurora": "pnpm --filter=\"./packages/dist2/@aurora/**\" publish --no-git-checks --access=public",
"pub:theme": "pnpm --filter=\"./packages/theme/dist\" publish --no-git-checks --access=public",
"pub:themeMobile": "pnpm --filter=\"./packages/theme-mobile/dist/\" publish --no-git-checks --access=public",
"pub:themeSaas": "pnpm --filter=\"./packages/theme-saas/dist\" publish --no-git-checks --access=public",
"pub:renderless": "pnpm --filter=\"./packages/renderless/dist\" publish --no-git-checks --access=public",
"pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless",
"// ---------- unit单元测试 ----------": "",
"test:unit2": "pnpm -C examples/vue2 test:unit",
"test:unit2.7": "pnpm -C examples/vue2.7 test:unit",
Expand Down

0 comments on commit 016aac5

Please sign in to comment.