docs: 📝 文档详细描述 #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
release: | |
description: "是否发布" | |
required: false | |
default: false | |
jobs: | |
build: | |
name: build-${{matrix.os}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@master | |
with: | |
node-version: "18" | |
- name: Prepare | |
run: | | |
echo "date=$(date "+%Y%m%d%H%M%S")" >> $GITHUB_ENV | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install | |
run: pnpm install | |
- name: Lint | |
run: pnpm lint | |
- name: Build | |
run: pnpm build | |
- name: Upload | |
uses: actions/[email protected] | |
with: | |
name: vue3-starter-${{ env.date }} | |
path: dist | |
- name: Package Version Updated | |
uses: MontyD/[email protected] | |
id: version-updated | |
with: | |
path: package.json | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tar | |
if: steps.version-updated.outputs.has-updated || github.event.inputs.release | |
run: | | |
cd dist | |
tar -zcvf vue3-starter-${{ steps.version-updated.outputs.current-package-version }}.tar.gz * | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
if: steps.version-updated.outputs.has-updated || github.event.inputs.release | |
with: | |
name: ${{ steps.version-updated.outputs.current-package-version }} | |
tag: ${{ env.date }} | |
token: ${{ secrets.REPO_TOKEN }} | |
artifacts: "dist/vue3-starter-${{ steps.version-updated.outputs.current-package-version }}.tar.gz" |