Update interview #127
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
name: Auto Update to Github Pages. | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- '**.md' | |
- 'scripts/convert.py' | |
- 'scripts/convert.yaml' | |
- '.github/workflows/AutoUpdateGithubPages.yml' | |
env: | |
REPO_SSH: [email protected]:SWHL/AI-Competition-Collections.git | |
USER_NAME: SWHL | |
USER_EMAIL: [email protected] | |
CLONE_DIR: AI-Competition-Collections | |
SUBMMIT_BRANCH: hugo_source | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set SSH Environment | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* | |
git config --global user.name $USER_NAME | |
git config --global user.email $USER_EMAIL | |
- name: Convert all md files to hugo format. | |
run: | | |
pip install PyYAML | |
git clone $REPO_SSH ${CLONE_DIR} | |
cd ${CLONE_DIR}/scripts | |
python convert.py | |
- name: Summit repo to hugo_source branch. | |
run: | | |
git clone -b ${SUBMMIT_BRANCH} $REPO_SSH ${SUBMMIT_BRANCH} | |
cd ${SUBMMIT_BRANCH} | |
rm -r content | |
cp -r ../${CLONE_DIR}/content . | |
git add . | |
git status | |
git commit -m 'Actions auto update' && git push -f origin ${SUBMMIT_BRANCH} || echo "No changes to commit" |