Rob Zolkos

January 31, 2024

Daily backups and diffs of ONCE Campfire source code

When you purchase Campfire from 37Signals, you will be able to download the source code.  This download is a ZIP file and includes no git information.  You do need to include your purchase token in the url of the download and if valid the source zip will download. 

You are permitted of course to push that code to your own private git repository.   By adding the Github Action workflow file below to your PRIVATE Campfire repo,  Github Actions will download the ONCE Campfire code, unzip it, and then push a commit with todays date.  You will then have nice diffs of changes made to the source. If there is no changes then no action will be taken. 

CleanShot 2024-01-30 at 19.31.17@2x.png


You will need to add your PURCHASE_TOKEN into the Actions secrets in your github repo secrets.

name: Update Campfire Source

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

jobs:
  update:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v2
      - name:
        run: |
          find . -mindepth 1 -maxdepth 1 ! -name .git ! -name . ! -name .. ! -path './.github' ! -path './.github/*' -exec rm -rf {} +
          curl -o download.zip https://auth.once.com/download/${{ secrets.PURCHASE_TOKEN }}
          unzip -o download.zip
          rm download.zip
          git config --local user.email "github-actions@users.noreply.github.com"
          git config --local user.name "github-actions"
          git add .
          git diff --staged --quiet || git commit -m "Updated source files $(date +%F)"
          git push origin main


Thanks to Dave Kimura from Drifting Ruby for helping me test this out and make suggestions.

* Keep your PURCHASE_TOKEN and Github repo private.

Let me know if you can think of anything to add to this.

About Rob Zolkos

Ruby on Rails developer here to help solo devs and small teams amplify their impact. Embracing the Rails way with Hotwire and Stimulus. Email: robzolkos@hey.com Twitter: https://twitter.com/robzolkos