Skip to content

Deploy to GitHub Pages #18

Deploy to GitHub Pages

Deploy to GitHub Pages #18

Workflow file for this run

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:latest .
- name: Run script inside Docker container
run: |
docker run --name temp_container -v ${{ github.workspace }}:/app --env TOKEN=${{ secrets.TOKEN }} -d my-app:latest
docker exec temp_container sh -c "cd /app && python generate_html.py && bundle exec jekyll build"
docker cp temp_container:/app/_site ${{ github.workspace }}
docker rm temp_container
- 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