Merge pull request #169 from vim-jp/filter-channel-json #439
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 pages' | |
on: | |
push: | |
branches: | |
- '**' | |
workflow_run: | |
workflows: ['Update logs'] | |
types: ['completed'] | |
jobs: | |
build-pages: | |
name: 'Generate htdocs and Update https://vim-jp.org/slacklog/' | |
if: "${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}" | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: 'Checkout generator' | |
uses: 'actions/checkout@v2' | |
with: | |
path: 'generator' | |
- name: 'Checkout log-data' | |
uses: 'actions/checkout@v2' | |
with: | |
repository: 'vim-jp/slacklog' | |
path: 'data' | |
ref: 'log-data' | |
- name: 'Checkout gh-pages' | |
uses: 'actions/checkout@v2' | |
with: | |
repository: 'vim-jp/slacklog' | |
path: 'pages' | |
ref: 'gh-pages' | |
ssh-key: '${{ secrets.SLACKLOG_SSH_KEY }}' | |
- name: 'Generate htdocs' | |
run: | | |
cp -r data/files/ data/emojis/ generator/static/* pages/ | |
rm -fr data/files/ data/emojis/ | |
cd generator | |
BASEURL=/slacklog go run . generate-html --filesdir ../pages/files/ --indir ../data/slacklog_data/ --outdir ../pages/ | |
go run . build-index --datadir ../data/slacklog_data --outdir ../pages/index | |
# create finger print | |
cd ../pages | |
find . -type d -name '.git' -prune -o -type f -print0 | xargs -0 md5sum > ../files.txt | |
- name: 'Save fingerprint' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: fingerprint | |
path: files.txt | |
- name: 'Update https://vim-jp.org/slacklog/' | |
if: github.ref == 'refs/heads/master' | |
working-directory: './pages' | |
run: | | |
git add --all --intent-to-add --force | |
if git diff --exit-code --quiet; then | |
echo 'Nothing to update.' | |
exit 0 | |
fi | |
git config user.email "[email protected]" | |
git config user.name "Slack Log Generator" | |
git commit --all --message 'Update pages' --quiet | |
git push origin gh-pages --quiet |