Update and Deploy #1020
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: Update and Deploy | |
on: | |
schedule: | |
# Once a day at 8 AM | |
- cron: 0 8 * * * | |
workflow_dispatch: {} | |
jobs: | |
iroh: | |
name: Update | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
bundler-cache: true | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- name: Install dependencies | |
run: npm install | |
- name: Build blog | |
run: bundle exec ruby bin/blog | |
- name: Commit Blog Changes and deploy | |
run: | | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "Setting Config for Git" | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
bin/deploy "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" "${{ github.repository }}" | |
bin/commit.sh "Add new changes for the blog" \ | |
"${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \ | |
"${{ github.repository }}" \ | |
${{ github.ref }} \ | |
"data/blog.json" | |
fi |