update entry list & bugfix #132
This file contains hidden or 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: Generate data | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| workpath: ./questionnaires | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up timezone | |
| uses: szenius/set-timezone@v1.0 | |
| with: | |
| timezoneLinux: "Asia/Shanghai" | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| working-directory: ${{ env.workpath }} | |
| - name: Checkout old dist | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: 'generated' | |
| path: questionnaires/dist | |
| - name: Generate data | |
| run: python main.py | |
| working-directory: ${{ env.workpath }} | |
| - name: Push generated data to branch generated | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| branch: generated | |
| repository: questionnaires/dist | |
| commit_options: '--allow-empty' | |
| commit_message: | | |
| update generated data | |
| Triggered by ${{ github.sha }} | |
| - name: Setup SSH | |
| env: | |
| SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
| run: | | |
| ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
| ssh-add - <<< "${{ secrets.COLLEGES_CHAT_DEPLOY_KEY }}" | |
| - name: Push generated data to repo colleges.chat | |
| env: | |
| SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
| GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git clone git@github.com:CollegesChat/colleges.chat.git --depth 1 | |
| commit_message="$(git log --pretty="%h %s" -1)" | |
| rm -rf colleges.chat/docs | |
| rm -f colleges.chat/mkdocs.yml | |
| mv questionnaires/dist/docs colleges.chat/docs | |
| mv questionnaires/dist/mkdocs.yml colleges.chat/mkdocs.yml | |
| cd colleges.chat | |
| git add -A | |
| if ! git diff-index --quiet HEAD --; then git commit -m "update: $commit_message" && git push -f ; fi |