Skip to content

Commit

Permalink
Fill out CI script, add CD script (foundryvtt#2446)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam committed Jun 13, 2022
1 parent e1cf16a commit c162f8d
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_size = 2
58 changes: 58 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: PF2e System CD

on:
workflow_dispatch:
branches: [release-v9]
workflow_run:
branches: [release-v9]
workflows: [PF2e System CI]
types: [completed]

jobs:
release:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- name: Fetch Build
uses: actions/cache@v3
with:
path: dist/
key: build-

- name: Update Manifest
run: |
perl -pi -e 's/(?<="version": )"([^"]+)"/"$1.$ENV{GITHUB_RUN_NUMBER}"/' dist/system.json
SYSTEM_VERSION=$(grep -oP '(?<="version": ")[^"]+' dist/system.json | tr -d '\n')
echo "systemVersion=$SYSTEM_VERSION" >> $GITHUB_ENV
- name: Zip Files
working-directory: ./dist
run: zip -r ./pf2e.zip ./*

- name: Create Version Release
id: create_version_release
uses: ncipollo/release-action@v1
with:
name: ${{ env.systemVersion }}
allowUpdates: false
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './dist/system.json,./dist/pf2e.zip'
tag: ${{ env.systemVersion }}

- name: Create Latest Release
id: create_latest_release
uses: ncipollo/release-action@v1
with:
name: Latest
allowUpdates: true
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './dist/system.json,./dist/pf2e.zip'
tag: latest
63 changes: 47 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: PF2e System CI

on:
push:
branches: [master]
pull_request:
branches: [master]
push:
branches: [master, release-v9]
workflow_dispatch:
branches: [master, release-v9]

jobs:
build:
Expand All @@ -15,21 +17,50 @@ jobs:
node-version: [16.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache NPM Deps
id: cache-npm
uses: actions/cache@v3
with:
path: node_modules/
key: npm-${{ hashFiles('package-lock.json') }}

- name: Install NPM Deps
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: |
npm ci
- name: Cache Packs
id: cache-packs
uses: actions/cache@v3
with:
path: packs/
key: packs-${{ hashFiles('packs/**/*') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Build Packs
if: ${{ steps.cache-packs.outputs.cache-hit != 'true' }}
run: |
npm run build:packs
- name: Install Deps
run: |
npm ci
- name: Webpack
run: |
node_modules/.bin/webpack --mode production
- name: Build
run: |
npm run build
- name: Test
run: |
npm run test
- name: Test
run: |
npm run test
- name: Cache Build
uses: actions/cache@v3
if: ${{ github.ref_name == 'release-v9' }}
with:
path: dist/
key: build-${{ hashFiles('dist/') }}
restore-keys: |
build-
12 changes: 6 additions & 6 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Pathfinder 2nd Edition",
"description": "A community contributed game system for Pathfinder Second Edition",
"license": "./LICENSE",
"version": "3.10.4",
"version": "3.11.0",
"minimumCoreVersion": "9.266",
"compatibleCoreVersion": "9.276",
"author": "The PF2e System Developers",
Expand Down Expand Up @@ -587,9 +587,9 @@
"gridDistance": 5,
"gridUnits": "ft",
"primaryTokenAttribute": "attributes.hp",
"url": "https://gitlab.com/hooking/foundry-vtt---pathfinder-2e",
"bugs": "https://gitlab.com/hooking/foundry-vtt---pathfinder-2e/-/issues",
"changelog": "https://gitlab.com/hooking/foundry-vtt---pathfinder-2e/-/raw/release-v9/CHANGELOG.md",
"manifest": "https://gitlab.com/hooking/foundry-vtt---pathfinder-2e/-/jobs/artifacts/release-v9/raw/system.json?job=build",
"download": "https://gitlab.com/hooking/foundry-vtt---pathfinder-2e/-/jobs/artifacts/release-v9/raw/pf2e.zip?job=build"
"url": "https://github.com/foundryvtt/pf2e",
"bugs": "https://github.com/foundryvtt/pf2e/issues",
"changelog": "https://github.com/foundryvtt/pf2e/blob/release-v9/CHANGELOG.md",
"manifest": "https://github.com/stwlam/pf2e/releases/download/latest/system.json",
"download": "https://github.com/stwlam/pf2e/releases/download/latest/pf2e.zip"
}

0 comments on commit c162f8d

Please sign in to comment.