gordonchanfz
Update deploy.yml
50f23f6 unverified
raw
history blame
1.82 kB
name: Restart Hugging Face Space
on:
workflow_dispatch:
inputs:
monitor_id:
description: 'input_monitor_id'
required: true
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
ref: main
- name: Set environment variables
run: |
if [ "${{ github.event.inputs.monitor_id }}" = "13" ]; then
export HF_TOKEN="${{ secrets.HF_1 }}"
export USERNAME="GordonChan365"
export SPACE="bot-example"
elif [ "${{ github.event.inputs.monitor_id }}" = "21" ]; then
export HF_TOKEN="${{ secrets.HF_1 }}"
export USERNAME="GordonChan365"
export SPACE="hf-llm-api"
elif [ "${{ github.event.inputs.monitor_id }}" = "2" ]; then
export HF_TOKEN="${{ secrets.HF_2 }}"
export USERNAME="gordonchan"
export SPACE="another-space"
else
echo "Invalid monitor_id"
exit 1
fi
rm -fr .githup
rm -f README.md
echo "
---
title: $SPACE
emoji: 🏢
colorFrom: yellow
colorTo: red
sdk: docker
app_port: 23333
pinned: false
---
">README.md
git add -A
git commit -m "update"
git push -f https://$USERNAME:$HF_TOKEN@huggingface.co/spaces/$USERNAME/$SPACE main:main
# - name: Update README title
# run: |
# sed -i "s/title: .*/title: $SPACE/" README.md
# - name: Restart Space
# run: |
# git push -f https://$USERNAME:$HF_TOKEN@huggingface.co/spaces/$USERNAME/$SPACE main:main