Tracking Writebook Changes

Episode #464 by Teacher's Avatar David Kimura

Summary

In this episode, we look at setting up a mechanism to track the changes from an externally developed product. We'll also discuss branching strategies and how to develop your own features on top of Writebook.
rails development ci/cd github actions 15:10

Chapters

  • Introduction (0:00)
  • Getting Writebook (1:46)
  • Create Github Repository (2:13)
  • Cloning the project (2:30)
  • Creating the Github Actions (2:49)
  • Pushing the branches to Github (7:06)
  • Verifying the branches on Github (7:41)
  • Setting the PURCHASE_TOKEN (8:05)
  • Trying to run the Action (8:31)
  • Rebasing from the ingress (9:34)
  • Getting the app running (10:32)
  • First commit to main (11:42)
  • Warning about merge conflicts (12:47)
  • Triggering the workflow manually (14:07)
  • Note about deploying with Kamal (14:34)

Resources

Writebook - https://once.com/writebook

Episode #440 Campfire Deploy with Kamal - https://www.driftingruby.com/episodes/campfire-deploy-with-kamal

This episode is sponsored by Honeybadger

Summary

# Terminal
git checkout -b ingress
git rebase ingress
asdf local ruby 3.3.1
bin/rails s

# .github/workflows/ingress.yml
name: Update Writebook Source

on:
  schedule:
    - cron: "0 3 * * *"
  workflow_dispatch:

jobs:
  update:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ingress
      - name: Remove Old Files
        run: |
          shopt -s extglob
          rm -rf !(|.git|.|..)
      - name: Download and Unzip Source
        run: |
          curl -o download.zip https://auth.once.com/download/${{ secrets.PURCHASE_TOKEN }}
          unzip -o download.zip
          rm download.zip
      - name: Configure Git
        run: |
          git config --local user.email "github-actions@users.noreply.github.com"
          git config --local user.name "github-actions"
      - name: Commit and Push Changes
        run: |
          git add .
          git diff --staged --quiet || git commit -m "Update source files $(date +%F)"
          git push origin ingress

# .gitignore
log/*.log
storage/db/*
storage/files/*
tmp/local_secret.txt
tmp/restart.txt