mirror of
https://github.com/OpenListTeam/OpenList-Frontend.git
synced 2026-03-15 03:20:25 +00:00
ci: split build and release
This commit is contained in:
74
.github/workflows/build.yml
vendored
74
.github/workflows/build.yml
vendored
@@ -6,23 +6,7 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
name: Create release changelog
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.MY_TOKEN}}
|
||||
|
||||
build:
|
||||
needs: changelog
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
@@ -46,73 +30,27 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: main
|
||||
path: alist-web
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout dist repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: alist-org/web-dist
|
||||
ref: main
|
||||
path: web-dist
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Replace version
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
version=$(git describe --abbrev=0 --tags)
|
||||
sed -i -e "s/0.0.0/$version/g" alist-web/package.json
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd alist-web
|
||||
pnpm install
|
||||
pnpm i18n
|
||||
pnpm build
|
||||
cp -r dist ../
|
||||
cd ..
|
||||
env:
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Copy dist and commit
|
||||
run: |
|
||||
cd web-dist
|
||||
rm -rf dist
|
||||
cp -r ../dist .
|
||||
git add .
|
||||
git config --local user.email "i@nn.ci"
|
||||
git config --local user.name "Noah Hsu"
|
||||
git commit --allow-empty -m "upload dist files" -a
|
||||
cd ..
|
||||
|
||||
- name: Upload dist files
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.MY_TOKEN }}
|
||||
branch: main
|
||||
directory: web-dist
|
||||
repository: alist-org/web-dist
|
||||
|
||||
- name: Publish npm
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
cd alist-web
|
||||
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
|
||||
pnpm publish --no-git-checks
|
||||
cd ..
|
||||
|
||||
- name: Compress dist files
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
- name: Compress dist
|
||||
run: |
|
||||
mkdir compress
|
||||
tar -czvf compress/dist.tar.gz dist/*
|
||||
zip -r compress/dist.zip dist/*
|
||||
|
||||
- name: Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: softprops/action-gh-release@v1
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
files: compress/*
|
||||
name: alist-web
|
||||
path: compress
|
||||
|
||||
91
.github/workflows/release.yml
vendored
Normal file
91
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
name: Create release changelog
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.MY_TOKEN}}
|
||||
|
||||
release:
|
||||
needs: changelog
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
name: Release
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "16"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- uses: pnpm/action-setup@v2.2.2
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 7
|
||||
run_install: false
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: main
|
||||
path: alist-web
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout dist repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: alist-org/web-dist
|
||||
ref: main
|
||||
path: web-dist
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mv alist-web/release.sh .
|
||||
bash release.sh
|
||||
env:
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Publish npm
|
||||
run: |
|
||||
cd alist-web
|
||||
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
|
||||
pnpm publish --no-git-checks
|
||||
cd ..
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Upload dist files
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.MY_TOKEN }}
|
||||
branch: main
|
||||
directory: web-dist
|
||||
repository: alist-org/web-dist
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: compress/*
|
||||
18
package.json
18
package.json
@@ -1,7 +1,23 @@
|
||||
{
|
||||
"name": "alist-web",
|
||||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"author": {
|
||||
"name": "Xhofe",
|
||||
"email": "i@nn.ci",
|
||||
"url": "https://www.nn.ci"
|
||||
},
|
||||
"description": "The front end of Alist V3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/alist-org/alist-web.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Xhofe/alist/issues"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://alist.nn.ci",
|
||||
"scripts": {
|
||||
"crowdin": "crowdin download",
|
||||
"i18n": "pnpm crowdin -b main --verbose && node ./scripts/i18n.mjs",
|
||||
|
||||
27
release.sh
Normal file
27
release.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
# replace version
|
||||
cd alist-web
|
||||
version=$(git describe --abbrev=0 --tags)
|
||||
sed -i -e "s/0.0.0/$version/g" package.json
|
||||
cat package.json
|
||||
|
||||
# build
|
||||
pnpm install
|
||||
pnpm i18n
|
||||
pnpm build
|
||||
cp -r dist ../
|
||||
cd ..
|
||||
|
||||
# commit to web-dist
|
||||
cd web-dist
|
||||
rm -rf dist
|
||||
cp -r ../dist .
|
||||
git add .
|
||||
git config --local user.email "i@nn.ci"
|
||||
git config --local user.name "Noah Hsu"
|
||||
git commit --allow-empty -m "upload $version dist files" -a
|
||||
git tag -a $version -m "release $version"
|
||||
cd ..
|
||||
|
||||
mkdir compress
|
||||
tar -czvf compress/dist.tar.gz dist/*
|
||||
zip -r compress/dist.zip dist/*
|
||||
Reference in New Issue
Block a user