Jekyll importer #1763
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: Jekyll importer | |
on: | |
push: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
importer: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- uses: actions/checkout@v3 | |
# Step 2: Install dependencies for ruby-build | |
- name: Install dependencies for ruby-build | |
run: sudo apt-get install -y build-essential libssl-dev zlib1g-dev libreadline-dev | |
# Step 3: Cache Ruby installation | |
- name: Cache Ruby | |
id: cache-ruby | |
uses: actions/cache@v3 | |
with: | |
path: /opt/hostedtoolcache/Ruby/3.1.4/x64 | |
key: ${{ runner.os }}-ruby-3.1.4 | |
restore-keys: | | |
${{ runner.os }}-ruby- | |
# Step 4: Clone ruby-build and install Ruby 3.1.4 manually if not cached | |
- name: Clone ruby-build | |
if: steps.cache-ruby.outputs.cache-hit != 'true' | |
run: git clone https://github.com/rbenv/ruby-build.git /tmp/ruby-build | |
- name: Install Ruby 3.1.4 | |
if: steps.cache-ruby.outputs.cache-hit != 'true' | |
run: /tmp/ruby-build/bin/ruby-build 3.1.4 /opt/hostedtoolcache/Ruby/3.1.4/x64 | |
# Step 5: Mark the Ruby installation as complete | |
- name: Mark Ruby installation as complete | |
if: steps.cache-ruby.outputs.cache-hit != 'true' | |
run: touch /opt/hostedtoolcache/Ruby/3.1.4/x64.complete | |
# Step 6: Set up Ruby (using the manually installed version) | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1.4' # Use the manually installed Ruby version | |
bundler-cache: true # Caches installed gems automatically | |
cache-version: 0 # Increment this number to refresh the cache | |
# Step 7: Set up Node.js | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "17" | |
# Step 8: Install Node.js dependencies | |
- run: npm install | |
# Step 9: Run the Notion Importer script | |
- run: node assets/js/notionImporter.js | |
env: | |
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
DATABASE_ID: ${{ secrets.DATABASE_ID }} | |
# Step 10: Auto-commit changes to GitHub | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN_FOR_GITHUB }} | |
with: | |
commit_message: Update Importer posts | |
branch: master | |
commit_user_name: importer-bot 🤖 | |
commit_user_email: [email protected] | |
commit_author: importer-bot 🤖 <[email protected]> |