diff --git a/.github/workflows/buildPacks.yml b/.github/workflows/buildPacks.yml new file mode 100644 index 0000000..eec79a7 --- /dev/null +++ b/.github/workflows/buildPacks.yml @@ -0,0 +1,53 @@ +# This is a basic workflow that is manually triggered +name: Build Packs + +# Controls when the action will run. Workflow runs when release is published. +on: + release: + types: [published] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called buildPacks + buildPacks: + # The type of runner that the job will run on. This must be ubuntu for the zip command to work. + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Each step runs a single command using the runners shell. + # 1. Checkout our repository so we can do things on it. + - name: Checkout + uses: actions/checkout@v4 + # 2. Make sure node is set up. This may be an unecessary step. + - name: Node Setup + uses: actions/setup-node@v3 + with: + node-version: 18 + # 3. Install the FoundryVTT CLI. + - run: npm install -g @foundryvtt/foundryvtt-cli + # 4. Configure the datapath as the github workspace variable. + - run: fvtt configure set "dataPath" ${GITHUB_WORKSPACE} + # 5. Tell the FVTT CLI that we are working on a "system" package. + - run: fvtt package workon fvtt package workon "deltagreen" --type "System" + # 6-11. Package each folder of source json files into the appropriate LevelDB pack. + - run: fvtt package pack "armor" --in "packs/source/armor" --out "packs" + - run: fvtt package pack "firearms" --in "packs/source/firearms" --out "packs" + - run: fvtt package pack "hand-to-hand-weapons" --in "packs/source/hand-to-hand-weapons" --out "packs" + - run: fvtt package pack "operation-code-name-generator" --in "packs/source/operation-code-name-generator" --out "packs" + - run: fvtt package pack "operation-code-name-generator-macro" --in "packs/source/operation-code-name-generator-macro" --out "packs" + - run: fvtt package pack "pregens" --in "packs/source/pregens" --out "packs" + # 12. Zip up the branch with the LevelDB packs. + - name: Zip + # Exclude the source json files from the final package, as well as any git folders. + run: zip -r deltagreen.zip . --exclude=*packs/source/* --exclude="*.git*" + # 13. Updates the release with the newly zipped branch. See documentation of this action for details. + - name: Update Release with Artifacts + uses: ncipollo/release-action@v1.13.0 + with: + allowUpdates: true + name: ${{ github.event.release.name }} + tag: ${{ github.event.release.tag_name }} + body: ${{ github.event.release.body }} + artifacts: './deltagreen.zip' + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file