mirror of https://github.com/Xhofe/alist
ci: auto generate drivers lang file
parent
7425e001db
commit
cc9ccc4e9b
|
@ -0,0 +1,59 @@
|
|||
name: auto_lang
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
|
||||
jobs:
|
||||
auto_lang:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ ubuntu-latest ]
|
||||
go-version: [ 1.19 ]
|
||||
name: auto generate lang.json
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Checkout alist
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: alist
|
||||
|
||||
- name: Checkout alist-web
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'alist-org/alist-web'
|
||||
ref: 'auto_lang'
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
path: alist-web
|
||||
|
||||
- name: Generate lang
|
||||
run: |
|
||||
cd alist
|
||||
go run ./main.go lang
|
||||
cd ..
|
||||
- name: Copy lang file
|
||||
run: |
|
||||
cp -f ./alist/drivers.json ./alist-web/src/lang/en/
|
||||
|
||||
- name: Commit git
|
||||
run: |
|
||||
cd alist-web
|
||||
git add .
|
||||
git config --local user.email "i@nn.ci"
|
||||
git config --local user.name "Noah Hsu"
|
||||
git commit --allow-empty -m "chore: update drivers translate file" -a
|
||||
cd ..
|
||||
|
||||
- name: Upload lang files
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.MY_TOKEN }}
|
||||
branch: auto_lang
|
||||
directory: alist-web
|
||||
repository: alist-org/alist-web
|
|
@ -7,11 +7,10 @@ import (
|
|||
|
||||
type Addition struct {
|
||||
driver.RootFolderPath
|
||||
NumFile int `json:"num_file" type:"number" default:"30" required:"true"`
|
||||
NumFolder int `json:"num_folder" type:"number" default:"30" required:"true"`
|
||||
MaxFileSize int64 `json:"max_file_size" type:"number" default:"1073741824" required:"true"`
|
||||
MinFileSize int64 `json:"min_file_size" type:"number" default:"1048576" required:"true"`
|
||||
TestSelect string `json:"test_select" type:"select" options:"a,b,c"`
|
||||
NumFile int `json:"num_file" type:"number" default:"30" required:"true"`
|
||||
NumFolder int `json:"num_folder" type:"number" default:"30" required:"true"`
|
||||
MaxFileSize int64 `json:"max_file_size" type:"number" default:"1073741824" required:"true"`
|
||||
MinFileSize int64 `json:"min_file_size" type:"number" default:"1048576" required:"true"`
|
||||
}
|
||||
|
||||
var config = driver.Config{
|
||||
|
|
|
@ -11,7 +11,7 @@ var Json = json.ConfigCompatibleWithStandardLibrary
|
|||
|
||||
// WriteJsonToFile write struct to json file
|
||||
func WriteJsonToFile(dst string, data interface{}) bool {
|
||||
str, err := Json.MarshalIndent(data, "", " ")
|
||||
str, err := json.MarshalIndent(data, "", " ")
|
||||
if err != nil {
|
||||
log.Errorf("failed convert Conf to []byte:%s", err.Error())
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue