update ignore. #170
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: build | |
on: [push] | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
env: | |
NOKOGIRI_USE_SYSTEM_LIBRARIES: true | |
GDRIVE_DIAGRAMS_FOLDER: "1eEIlz-qj75jd7TGKlkZ7S_pGt2OSQwIE" | |
GDRIVE_IMAGE: "gvfn/gdrive" | |
SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} | |
SERVICE_ACCOUNT_NAME: "devops-gvfn" | |
SERVICE_ACCOUNT_EMAIL: "[email protected]" | |
ONLY_DIAGRAMS: "FALSE" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
lfs: true | |
- name: Check Update | |
run: | | |
export GIT_CHANGES=( $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }}) ) | |
echo $GIT_CHANGES | |
diagramUpdateCount=0 | |
for i in "${GIT_CHANGES[@]}" | |
do | |
if [[ $(echo $i | grep "\.drawio$") == "" ]]; then | |
echo "NOT DIAGRAM: $i" | |
else | |
((diagramUpdateCount+=1)); | |
echo "DIAGRAM: $i" | |
echo "UPLOAD_DIAGRAMS=TRUE" >> $GITHUB_ENV | |
fi | |
done | |
echo "diagramUpdateCount: $diagramUpdateCount" | |
echo "GIT_CHANGES: ${#GIT_CHANGES[@]}" | |
if [[ ${#GIT_CHANGES[@]} == $diagramUpdateCount ]]; then | |
echo "ONLY DIAGRAMS" | |
echo "UPLOAD_DIAGRAMS=TRUE" >> $GITHUB_ENV | |
fi | |
- name: Upload to Diagrams to Google Drive | |
if: env.UPLOAD_DIAGRAMS == 'TRUE' || contains(github.event.head_commit.message, 'upload diagrams') | |
uses: docker://gvfn/gdrive | |
with: | |
entrypoint: "/bin/sh" | |
args: | | |
-c "\ | |
gdrive --config /gdrive --service-account-evar SERVICE_ACCOUNT_JSON sync upload /github/workspace/_gxp/diagrams ${GDRIVE_DIAGRAMS_FOLDER} && \ | |
gdrive --config /gdrive --service-account-evar SERVICE_ACCOUNT_JSON list>/github/workspace/_gxp/diagrams/_gdrive_diagrams_list.txt && \ | |
gdrive --config /gdrive --service-account-evar SERVICE_ACCOUNT_JSON about>>/github/workspace/_gxp/diagrams/_gdrive_diagrams_list.txt" | |
- name: Push Google Drive Stats to Repo | |
if: env.UPLOAD_DIAGRAMS == 'TRUE' || contains(github.event.head_commit.message, 'upload diagrams') | |
continue-on-error: true | |
run: | | |
git config --global user.name "${SERVICE_ACCOUNT_NAME}" | |
git config --global user.email "${SERVICE_ACCOUNT_EMAIL}" | |
git add *_gdrive_diagrams_list.txt | |
git commit -m "update _gdrive_diagrams_list.txt [skip ci]" | |
git push | |
# IF ONLY_DIAGRAMS is set don't do other steps | |
- name: install dependencies | |
if: env.ONLY_DIAGRAMS == 'FALSE' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libcurl4-openssl-dev libxslt-dev libxml2-dev | |
- uses: actions/setup-ruby@v1 | |
if: env.ONLY_DIAGRAMS == 'FALSE' | |
with: | |
ruby-version: '2.x' # Version range or exact version of a Ruby version to use, using semvers version range syntax. | |
- name: build | |
if: env.ONLY_DIAGRAMS == 'FALSE' | |
run: | | |
export LANG=en_US.UTF-8 | |
export JEKYLL_ENV=production | |
bundle install | |
bundle exec jekyll build --future --profile --trace --verbose | |
- name: deploy | |
if: env.ONLY_DIAGRAMS == 'FALSE' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site |