Deploy to GitHub Pages #13
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 to GitHub Pages | |
on: | |
schedule: | |
- cron: '0 0 * * *' # 毎日0時に実行 | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout build branch | |
uses: actions/checkout@v2 | |
with: | |
ref: build | |
- name: Build Docker image | |
run: docker build -t my-app . | |
- name: Run script inside Docker container | |
run: | | |
docker create --name temp_container -v ${{ github.workspace }}:/app --env TOKEN=${{ secrets.TOKEN }} my-app | |
docker start temp_container | |
docker exec temp_container sh -c "cd /app && python generate_html.py && bundle exec jekyll build" | |
docker cp temp_container:/app/_site ${{ github.workspace }} | |
- name: Commit and push to build | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add _site/* | |
git commit -m "Automated deployment: $(date +'%Y-%m-%d %H:%M:%S')" | |
git push origin build |