Skip to content

Commit

Permalink
use makefile (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
shunk031 authored Jun 25, 2024
1 parent 3a92f10 commit 4f07df8
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 102 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/layout_alignment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,4 @@ jobs:
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
make deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
18 changes: 1 addition & 17 deletions .github/workflows/layout_average_iou.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,4 @@ jobs:
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
make deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
18 changes: 1 addition & 17 deletions .github/workflows/layout_generative_model_scores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,4 @@ jobs:
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
make deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
18 changes: 1 addition & 17 deletions .github/workflows/layout_maximum_iou.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,4 @@ jobs:
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
make deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
18 changes: 1 addition & 17 deletions .github/workflows/layout_overlap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,4 @@ jobs:
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
make deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
18 changes: 1 addition & 17 deletions .github/workflows/layout_validity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,4 @@ jobs:
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
make deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SRC_DIR := ./github-repo
DST_DIR := ./huggingface-repo

.PHONY: check-vars
check-vars:
ifndef ($(REPO_NAME),)
$(error REPO_NAME is not set)
endif

ifndef ($(DIR_NAME),)
$(error DIR_NAME is not set)
endif

ifndef ($(HF_USERNAME),)
$(error HF_USERNAME is not set)
endif

ifndef ($(HF_EMAIL),)
$(error HF_EMAIL is not set)
endif

.PHONY: deploy
deploy: check-vars
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

0 comments on commit 4f07df8

Please sign in to comment.