action-lee-cq-10546201012-11 #11
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
name: Alist Server | |
run-name: "action-${{github.actor}}-${{github.run_id}}-${{github.run_number}}" | |
on: | |
workflow_dispatch: | |
env: | |
_ALIST_SYNC_NAME: "${{github.run-name}}" | |
_ALIST_SYNC_DEBUG: ${{ github.event.inputs.debug }} | |
_ALIST_ADMIN_PASSWORD: ${{ secrets.ALIST_ADMIN_PASSWORD }} | |
jobs: | |
run: | |
name: "sync-actions" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python v4 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Create Tunnel for Cloudflare | |
run: | | |
echo RUNNER = ${_ALIST_SYNC_NAME} | |
test ! -n "${{secrets.CLOUDFLARE_TUNNEL_TOKEN}}" && { | |
echo "CLOUDFLARE_TUNNEL_TOKEN is not set. Skip Cloudflare Tunnel Installation." | |
exit 0 | |
} | |
echo "Installing Cloudflare Tunnel ..." | |
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && | |
sudo dpkg -i cloudflared.deb && | |
sudo cloudflared service install ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }} | |
echo "CLOUDFLARE_INSTALLED=true" >> "$GITHUB_ENV" | |
echo "Cloudflare Tunnel Installed." | |
- name: Install Grafana Alloy | |
run: | | |
sudo hostname alist-sync-${{github.run_id}} | |
echo $(hostname) | |
echo "Installing Grafana Alloy ..." | |
${{ secrets.GRAFANA_ALLOY_INSTALL_CMD }} | |
- 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 | |
python3 tools/create_storage.py | |
- name: Run Alist Server | |
run: | | |
if [ -e "alist/data/logs/log.log" ]; then | |
tail -100f alist/data/logs/log.log | |
else | |
echo "No log file found." | |
sleep 36000 | |
fi |