mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Update deploy-to-hf-spaces.yml
This commit is contained in:
parent
c0095e8596
commit
6db24484aa
1 changed files with 50 additions and 11 deletions
61
.github/workflows/deploy-to-hf-spaces.yml
vendored
61
.github/workflows/deploy-to-hf-spaces.yml
vendored
|
@ -1,20 +1,59 @@
|
||||||
name: Sync to Hugging Face hub
|
name: Deploy to HuggingFace Spaces
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- dev
|
||||||
# to run this workflow manually from the Actions tab
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync-to-hub:
|
check-secret:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
token-set: ${{ steps.check-key.outputs.defined }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- id: check-key
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
lfs: true
|
|
||||||
- name: Push to hub
|
|
||||||
env:
|
env:
|
||||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
run: git push https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/tokenfactory/localsearch main
|
if: "${{ env.HF_TOKEN != '' }}"
|
||||||
|
run: echo "defined=true" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [check-secret]
|
||||||
|
if: needs.check-secret.outputs.token-set == 'true'
|
||||||
|
env:
|
||||||
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Remove git history
|
||||||
|
run: rm -rf .git
|
||||||
|
|
||||||
|
- name: Prepend YAML front matter to README.md
|
||||||
|
run: |
|
||||||
|
echo "---" > temp_readme.md
|
||||||
|
echo "title: Open WebUI" >> temp_readme.md
|
||||||
|
echo "emoji: 🐳" >> temp_readme.md
|
||||||
|
echo "colorFrom: purple" >> temp_readme.md
|
||||||
|
echo "colorTo: gray" >> temp_readme.md
|
||||||
|
echo "sdk: docker" >> temp_readme.md
|
||||||
|
echo "app_port: 8080" >> temp_readme.md
|
||||||
|
echo "---" >> temp_readme.md
|
||||||
|
cat README.md >> temp_readme.md
|
||||||
|
mv temp_readme.md README.md
|
||||||
|
|
||||||
|
- name: Configure git
|
||||||
|
run: |
|
||||||
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
- name: Set up Git and push to Space
|
||||||
|
run: |
|
||||||
|
git init --initial-branch=main
|
||||||
|
git lfs track "*.ttf"
|
||||||
|
rm demo.gif
|
||||||
|
git add .
|
||||||
|
git commit -m "GitHub deploy: ${{ github.sha }}"
|
||||||
|
git push --force https://open-webui:${HF_TOKEN}@huggingface.co/spaces/tokenfactory/localsearch main
|
||||||
|
|
Loading…
Add table
Reference in a new issue