Skip to content

Commit

Permalink
update workflow alist-server.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-cq committed Aug 23, 2024
1 parent 29cb913 commit f71dfa7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 58 deletions.
58 changes: 7 additions & 51 deletions .github/workflows/alist-server.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
name: Alist Sync
name: Alist Server
run-name: "action-${{github.actor}}-${{github.run_id}}-${{github.run_number}}"
on:
workflow_dispatch:
inputs:
reload_storage:
description: 删除现有存储库,并从配置文件或远程配置中重新创建存储器
type: boolean
required: false
default: false


debug:
description: 开启调试模式
type: boolean
required: false
default: false

env:
_ALIST_SYNC_NAME: "${{github.run-name}}"
_ALIST_SYNC_DEBUG: ${{ github.event.inputs.debug }}
Expand All @@ -34,13 +22,6 @@ jobs:
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Create Tunnel for Cloudflare
run: |
echo RUNNER = ${_ALIST_SYNC_NAME}
Expand All @@ -56,48 +37,23 @@ jobs:
echo "CLOUDFLARE_INSTALLED=true" >> "$GITHUB_ENV"
echo "Cloudflare Tunnel Installed."
- name: Install Alist
run: |
ALIST_VERSION=$(curl -s https://api.github.com/repos/alist-org/alist/releases/latest | grep tag_name | cut -d '"' -f 4)
export ALIST_VERSION
download_url="https://github.com/alist-org/alist/releases/download/${version}/alist-linux-amd64.tar.gz"
wget -O alist.zip $download_url
tar -xf alist.zip
./alist admin password --set "$_ALIST_ADMIN_PASSWORD"
sed -i"" s'"workers": 5/"workers": 10/'g data/config.json
- name: Install and Init Alist Server
env:
_ALIST_ADMIN_PASSWORD: ${{ secrets.ALIST_ADMIN_PASSWORD }}

_ALIST_BACKUP_URL: ${{secrets.ALIST_BACKUP_URL}}
_ALIST_BACKUP_USERNAME: ${{secrets.ALIST_BACKUP_USERNAME}}
_ALIST_BACKUP_PASSWORD: ${{secrets.ALIST_BACKUP_PASSWORD}}
run: |
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ALIST_VERSION=$(curl -s https://api.github.com/repos/alist-org/alist/releases/latest | grep tag_name | cut -d '"' -f 4)
export ALIST_VERSION
bash -ex bootstrap.sh install
bash -x bootstrap.sh alist-init
bash -x bootstrap.sh alist start
- name: Create Storage for Alist
env:
_ALIST_ADMIN_PASSWORD: ${{ secrets.ALIST_ADMIN_PASSWORD }}

_ALIST_BACKUP: ${{secrets.ALIST_BACKUP}}
_ALIST_BACKUP_URL: ${{secrets.ALIST_BACKUP_URL}}
_ALIST_BACKUP_USERNAME: ${{secrets.ALIST_BACKUP_USERNAME}}
_ALIST_BACKUP_PASSWORD: ${{secrets.ALIST_BACKUP_PASSWORD}}

_RELOAD_STORAGE: ${{ github.event.inputs.reload_storage }}
run: |
echo RUNNER = ${_ALIST_SYNC_NAME}
# 这将会导入全部的内容包括:设置,元数据,用户,存储器。
echo $(pwd)
python3 tools/create_storage.py
bash -x bootstrap.sh alist stop
- name: Run Alist Server
run: |
./bootstrap.sh alist stop
./bootstrap.sh alist sever
./bootstrap.sh alist server
10 changes: 5 additions & 5 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

cd "$(dirname "$0")" || exit 1

set -a
. .env
set +a

# which python3 >/dev/null || alias python3=python
if [ -f .env ]; then
set -a
. .env
set +a
fi

if uname | grep -iq "NT"; then
PYTHONPATH="$(pwd);${PYTHONPATH}"
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ dependencies = [
"alist-sdk",
"typer",
"rich",
"async-lru",
"pydantic",
"pyyaml",
"pymongo"
]
dynamic = ["version"]

Expand Down

0 comments on commit f71dfa7

Please sign in to comment.