Skip to content

Commit

Permalink
ci: support auto deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
weaigc committed Aug 4, 2023
1 parent 82a3976 commit 1bc0b30
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 37 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Sync to Hugging Face hub
on:
repository_dispatch:
push:
branches:
- main

# to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- uses: actions/setup-node@v3
with:
node-version: 18
- name: sync to huggingface
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: ${{ secrets.HF_USERNAME }}
SPACE_NAME: ${{ secrets.SPACE_NAME }}
run: |
npm i
npm run build
git clone https://$HF_USERNAME:[email protected]/spaces/$HF_USERNAME/$SPACE_NAME --depth=1 target
find target -maxdepth 1 -regextype posix-egrep ! -iregex 'target/?(README.md|.git|.gitignore)' | xargs rm -rf
rm -rf target/*
mv out/* target
cd target
git config user.name $HF_USERNAME
git config user.email [email protected]
git add -A
git commit -am "auto deploy"
git push origin main -f
- name: Push to gh_pages
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: gh_pages # The branch name where you want to push the assets
FOLDER: target # The directory where your assets are generated
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
MESSAGE: "Build: ({sha}) {msg}" # The commit message
37 changes: 0 additions & 37 deletions .github/workflows/huggingface.yml

This file was deleted.

0 comments on commit 1bc0b30

Please sign in to comment.