-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: crrashh1542 <[email protected]>
- Loading branch information
1 parent
1e3eb95
commit f17907c
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Build Production Page | ||
on: | ||
push: | ||
branches: [wu_main] | ||
jobs: | ||
setup: | ||
name: Setup Project Info | ||
runs-on: ubuntu-latest | ||
outputs: | ||
DIST_SUFFIX: ${{ steps.get-suffix.outputs.DIST_SUFFIX }} | ||
steps: | ||
- name: 🧐 Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: 📙 Get Package Suffix | ||
id: get-suffix | ||
run: | | ||
## 此处通过 jq 从 packagr.json 获取版本,否则在 depth | ||
## 为 1 时通过 git tag 所读取的版本不准确 | ||
sudo apt-get install jq | ||
VERSION=$(jq -r '.version' ./package.json) | ||
COMMIT_COUNT=$(git rev-list --count HEAD) | ||
BUILD_DATE=$(date "+%y%m%d") | ||
HEAD_SHA=$(git rev-parse --short HEAD) | ||
echo "DIST_SUFFIX=v${VERSION}-${COMMIT_COUNT}-${BUILD_DATE}-${HEAD_SHA}" >> $GITHUB_OUTPUT | ||
build: | ||
name: Build Production Page | ||
needs: setup | ||
env: | ||
DIST_NAME: dist-${{ needs.setup.outputs.DIST_SUFFIX }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🧐 Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: 🛠️ Setup Node.js Env | ||
id: setup-node | ||
uses: actions/setup-node@main | ||
with: | ||
node-version: latest | ||
|
||
- name: 🔧 Setup Yarn | ||
id: setup-yarn | ||
run: | | ||
npm install yarn -g | ||
yarn set version berry | ||
- name: 🚧 Setup dependencies | ||
id: setup-deps | ||
run: | | ||
yarn add @vue/cli | ||
yarn install | ||
- name: ⚙️ Build production pages | ||
id: build | ||
run: | | ||
yarn build | ||
- name: 🌐 Upload the build | ||
id: upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.DIST_NAME }} | ||
path: dist | ||
retention-days: 60 |