modded7/.github/workflows/updateqb.yml
IntegerLimit 5aecff8b4d
Allow for QB Translations of Normal and Expert Quest Books (#432)
[FEATURE]

/* Description: */
Also moves all nodejs stuff into `tools` package.

Also adds a basic `CONTRIBUTING.md` file. 

Superseeds https://github.com/Nomi-CEu/Nomi-CEu/pull/431, which was closed as the branch needed to be renamed, due to the last two items on this list.

TODO:
- [x] Make it only run on master repo.
- [x] Remove qb-lang-revamp branch from the events
- [x] Allow workflow to run on all branches starting with test_buildscript?

/* Commits: */

* Buildscript Changes

* Make Contributing Docs a .md file

* updateqb.yml v1

* Test QB change

* Add lang file to commit file list

* Another Test Change

* Test with only lang path, + `./` at beginning of path

* Test QB change

* updateqb.yml v3

* Test QB Change

* Add some debug settings

* Remove debug, branch input. Switch to auto-commit action

* Make activate: branches prefix `test_buildscript`, commit author GHA bot

* Add branch prefix note into CONTRIBUTING.md

* Make workflow only run if on master repo
2023-09-17 22:44:48 +10:00

68 lines
2.1 KiB
YAML

# This workflow updates the main json files, and the en_us.lang, after a Quest Book change.
name: Update Quest Book Jsons and Lang
on:
workflow_dispatch:
push:
branches:
- main
- test_buildscript*
paths:
- "overrides/config/betterquesting/saved_quests/NormalQuestsDev.json" # Normal QB Developer Json
- "overrides/config/betterquesting/saved_quests/ExpertQuestsDev.json" # Expert QB Developer Json
jobs:
updateQB:
if: "${{ github.repository_owner == 'Nomi-CEu' }}"
name: Update Quest Book Jsons and Lang (${{ github.event.inputs.tag }})
runs-on: ubuntu-latest
env:
GITHUB_BRANCH: ${{ github.event.inputs.branch }}
permissions:
contents: write
steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag }}
- name: "Restore cached files"
uses: actions/cache@v3
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-
- name: "Setup NodeJS v16"
uses: actions/setup-node@v2
with:
node-version: "16"
check-latest: true
- name: "Download NPM packages"
working-directory: ./tools
run: npm ci
- name: "Transform QB"
working-directory: ./tools
run: npx gulp transformQB
- name: "Commit and push QB Changes"
uses: "stefanzweifel/git-auto-commit-action@v4"
id: "commit"
with:
commit_message: "Update Quest Book Jsons and Lang\n[SKIP]"
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
- name: "Throw Error if No Changes were Detected"
if: steps.commit.outputs.changes_detected == 'false'
run: |
echo "No QB Changes Detected. This may be intended, or an error."
exit 1