Merge pull request #141 from emacsway/emacsway #203
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: Push content to the user's GitHub pages repository | |
on: | |
push: | |
branches: | |
- system-architecture | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.10.13 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -y && sudo apt-get install -y git git-core libxml2-dev libxslt-dev python3.10-dev | |
sudo python -m pip install --upgrade pip | |
sudo pip install -r requirements.freeze.txt | |
- name: Make output folder | |
run: mkdir _build | |
- name: Clone master branch | |
run: git clone "https://${{ secrets.ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" --no-checkout --branch gh-pages --single-branch ./_build # git clone "https://${{ secrets.ACCESS_TOKEN }}@github.com/${GITHUB_ACTOR}/${GITHUB_ACTOR}.github.io.git" --branch master --single-branch ./_build | |
- name: Generate static pages | |
run: BASE_URL="https://"${GITHUB_REPOSITORY/\//.github.io\/} YANDEX_METRIKA_ID="${{ secrets.YANDEX_METRIKA_ID }}" sphinx-build -W -D language=ru -b html . _build | |
- name: Set git config and add changes | |
run: | | |
git config --global user.email "${GITHUB_ACTOR}@https://users.noreply.github.com/" | |
git config --global user.name "${GITHUB_ACTOR}" | |
touch .nojekyll | |
git add --all | |
working-directory: ./_build | |
- name: Push and send notification | |
run: | | |
COMMIT_MESSAGE="Update pages on $(date +'%Y-%m-%d %H:%M:%S')" | |
git diff-index --quiet --cached HEAD -- && echo "No changes!" && exit 0 || echo $COMMIT_MESSAGE | |
git commit -m "${COMMIT_MESSAGE}" | |
git push https://${{ secrets.ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git gh-pages | |
# git push https://${{ secrets.ACCESS_TOKEN }}@github.com/${GITHUB_ACTOR}/${GITHUB_ACTOR}.github.io.git master | |
# curl "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendMessage?text=$COMMIT_MESSAGE %0ALook at ${GITHUB_ACTOR}.github.io %0ARepository%3A github.com/${GITHUB_ACTOR}/${GITHUB_ACTOR}.github.io&chat_id=${{ secrets.ADMIN_ID }}" | |
working-directory: ./_build |