Skip to content

Max. IoU

Max. IoU #14

name: Max. IoU
on:
workflow_run:
workflows:
- CI
branches:
- main
types:
- completed
jobs:
push_to_hub:
runs-on: ubuntu-latest
env:
REPO_NAME: "layout-maximum-iou"
DIR_NAME: "layout_maximum_iou"
SRC_DIR: ./github-repo
DST_DIR: ./huggingface-repo
steps:
- name: Checkout GitHub repository
uses: actions/checkout@v3
with:
path: ${{ env.SRC_DIR }}
- name: Checkout Huggingface repository
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: ${{ secrets.HF_USERNAME }}
run: |
git clone https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${REPO_NAME} ${DST_DIR}
- name: Export requirements.txt
run: |
pip install poetry
poetry -C ${SRC_DIR} export -f requirements.txt --output ${DST_DIR}/requirements.txt --with miou --without-hashes
- name: Copy files to Huggingface repository
env:
HF_USERNAME: ${{ secrets.HF_USERNAME }}
HF_EMAIL: ${{ secrets.HF_EMAIL }}
run: |
SCRIPT_NAME=${REPO_NAME}.py
cp ${SRC_DIR}/${DIR_NAME}/README.md ${DST_DIR}/README.md
cp ${SRC_DIR}/${DIR_NAME}/${SCRIPT_NAME} ${DST_DIR}/${SCRIPT_NAME}
git -C ${DST_DIR} config user.name "${HF_USERNAME}"
git -C ${DST_DIR} config user.email "${HF_EMAIL}"
git -C ${DST_DIR} add README.md requirements.txt ${SCRIPT_NAME}
if git -C ${DST_DIR} diff --cached --quiet; then
echo "No changes to commit"
else
msg=$(git -C ${SRC_DIR} rev-parse HEAD)
git -C ${DST_DIR} commit -m "deploy: ${msg}"
git -C ${DST_DIR} push -u origin main
fi