release asserts files cdn

pull/548/head
微凉 2021-11-05 19:03:54 +08:00
parent 11b141b190
commit e7071e1093
4 changed files with 37 additions and 23 deletions

View File

@ -47,18 +47,8 @@ jobs:
go install src.techknowlogick.com/xgo@latest
sudo apt install upx
- name: Build web
run: |
cd alist-web
yarn
yarn build
cd ..
- name: Build
run: |
cd alist
bash build.sh
cd ..
run: bash build.sh
- name: Upload artifact
uses: actions/upload-artifact@v2

View File

@ -46,18 +46,16 @@ jobs:
go install src.techknowlogick.com/xgo@latest
sudo apt install upx
- name: Build web
run: |
cd alist-web
yarn
yarn build
cd ..
- name: Build
run: |
cd alist
bash build.sh release
cd ..
run: bash build.sh release
- name: Upload asserts files
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MY_TOKEN }}
branch: cdn
directory: alist-web
repository: https://github.com/Xhofe/alist-web
- name: Release
uses: softprops/action-gh-release@v1

View File

@ -30,7 +30,7 @@ func Init() {
func main() {
if conf.Version {
fmt.Printf("Built At: %s\nGo Version: %s\nAuthor: %s\nCommit ID: %s\nVersion:%s\n", conf.BuiltAt, conf.GoVersion, conf.GitAuthor, conf.GitCommit, conf.GitTag)
fmt.Printf("Built At: %s\nGo Version: %s\nAuthor: %s\nCommit ID: %s\nVersion: %s\n", conf.BuiltAt, conf.GoVersion, conf.GitAuthor, conf.GitCommit, conf.GitTag)
return
}
Init()

View File

@ -1,5 +1,18 @@
#!/bin/bash
cd alist-web || exit
webCommit=$(git log --pretty=format:"%h" -1)
echo "web commit id: $webCommit"
yarn
if [ "$1" == "release" ]; then
yarn build --base="https://cdn.jsdelivr.net/gh/Xhofe/alist-web@cdn/v2/$webCommit"
mv dist/assets ..
else
yarn build
fi
cd ..
cd alist
appName="alist"
builtAt="$(date +'%F %T %z')"
goVersion=$(go version | sed 's/go version //')
@ -52,4 +65,17 @@ if [ "$1" == "release" ]; then
do
zip compress/$(echo $i | sed 's/\.[^.]*$//').zip "$i"
done
fi
cd ../..
if [ "$1" == "release" ]; then
cd alist-web
git checkout cdn
mkdir "v2/$webCommit"
mv ../assets/ v2/$webCommit
git add .
git config --local user.email "i@nn.ci"
git config --local user.name "Xhofe"
git commit --allow-empty -m "upload $webCommit assets files" -a
cd ..
fi