Skip to content

Sync .ink files with Google Drive #35

Sync .ink files with Google Drive

Sync .ink files with Google Drive #35

Workflow file for this run

name: Sync .ink files with Google Drive
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
fetchInkScript:
name: "Fetch .ink files and commit if newer"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PATDOCSGEN }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate current hash of 2-1-FullScene.ink
run: echo "currentHash=$(find unity-ggjj/Assets/Resources/InkDialogueScripts/CaseDemo/2-1-FullScene.ink -type f -exec md5sum {} \; | md5sum)" >> $GITHUB_ENV
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version-file: 'asset_sync/.nvmrc'
- name: Remove current version of the scene
run: |
rm unity-ggjj/Assets/Resources/InkDialogueScripts/CaseDemo/2-1-FullScene.ink
rm unity-ggjj/Assets/Resources/InkDialogueScripts/CaseDemo/2-1-FullScene.json
- name: Fetch and write Scene from Google Drive using Node.js
run: node asset_sync/fetch_demo.js
shell: bash
- name: Generate new hash of 2-1-FullScene.ink
run: echo "newHash=$(find unity-ggjj/Assets/Resources/InkDialogueScripts/CaseDemo/2-1-FullScene.ink -type f -exec md5sum {} \; | md5sum)" >> $GITHUB_ENV
- name: Print hashes
run: |
echo "Current: '${{ env.currentHash }}'"
echo "New: '${{ env.newHash }}'"
- name: Regenerate .json file
uses: game-ci/unity-builder@v4
env:
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: unity-ggjj/
targetPlatform: ${{ inputs.unityPlatform }}
buildName: 'Game Grumps - Joint Justice'
buildMethod: Editor.Ink.BuildScript.Build
allowDirtyBuild: true
- name: Commit updated .ink and .json
if: env.currentHash != env.newHash
run: |
git config --global user.name github-actions
git config --global user.email 'github-actions@github.com'
git add unity-ggjj/Assets/Resources/InkDialogueScripts/CaseDemo/2-1-FullScene.ink
git add unity-ggjj/Assets/Resources/InkDialogueScripts/CaseDemo/2-1-FullScene.json
time=$(date +"%b %d, %Y %r")
git commit -am "feat(Seductive Reasoning Demo): New version from Google Docs on $time"
git push origin develop --force-with-lease