-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
37 deletions.
There are no files selected for viewing
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
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 |
This file was deleted.
Oops, something went wrong.