Deploy monadical.com #17032
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: Deploy monadical.com | |
on: | |
# autobuild whenever changes are pushed to master | |
push: | |
branches: | |
- master | |
# autobuild every 2hr so that view post counts dont lag too far behind actual view counts | |
schedule: | |
- cron: "0 */2 * * *" | |
# allow manually running the build from github actions page button | |
workflow_dispatch: | |
env: | |
ACTIVATE_VENV: 0 | |
TERM: xterm | |
BRANCH: master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
architecture: x64 | |
- name: Detect last autodeployment | |
run: | | |
LAST_COMMIT_MESSAGE=$(git log --oneline -n 1 HEAD) | |
echo "Last message: $LAST_COMMIT_MESSAGE" | |
LAST_AUTODEPLOYED=$(git log --oneline -n 1 HEAD | grep -q "Autodeployed by git hub actions" && echo "1" || echo "0") | |
echo "SKIP_STEP=$LAST_AUTODEPLOYED" >> $GITHUB_ENV | |
- name: Create local changes | |
if: env.SKIP_STEP == '0' | |
run: | | |
pip3 install flask feedgen | |
./build | |
- name: Commit files | |
if: env.SKIP_STEP == '0' | |
run: | | |
git config --local user.email "ci@monadical.com" | |
git config --local user.name "CI monadical.com" | |
git add templates/ | |
git add docs/ | |
git commit -m "Autodeployed by git hub actions" -a | |
- name: Push changes | |
if: env.SKIP_STEP == '0' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.AUTODEPLOY_GITHUB_TOKEN }} | |
branch: ${{ env.BRANCH }} |