From b948451c9e0e2c0068561ca2caa1a5d43a711072 Mon Sep 17 00:00:00 2001 From: John Nolan Date: Mon, 12 Dec 2022 20:45:00 +0000 Subject: [PATCH 1/3] Fix eslint reporting and caching --- .github/workflows/lint_job.yml | 8 ++++++++ .github/workflows/main_workflow.yml | 12 ++++-------- .github/workflows/publish_unit_tests_job.yml | 18 ++++++------------ .github/workflows/test_job.yml | 8 ++++++++ scripts/CampaignRenderer.ts | 2 ++ scripts/SetupHooksPF2e.ts | 1 - scripts/types/CampaignRenderer.d.ts | 2 +- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/lint_job.yml b/.github/workflows/lint_job.yml index 32d6bcca..3bb12e00 100644 --- a/.github/workflows/lint_job.yml +++ b/.github/workflows/lint_job.yml @@ -15,7 +15,15 @@ jobs: with: node-version-file: '.nvmrc' + - name: Cache yarn dependencies + id: cache + uses: actions/cache@v3 + with: + path: ./node_modules + key: modules-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: yarn install - name: Run ESLint diff --git a/.github/workflows/main_workflow.yml b/.github/workflows/main_workflow.yml index a177552f..b3fea390 100644 --- a/.github/workflows/main_workflow.yml +++ b/.github/workflows/main_workflow.yml @@ -39,19 +39,15 @@ jobs: with: node-version-file: '.nvmrc' - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - name: Cache yarn dependencies + id: cache uses: actions/cache@v3 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + path: ./node_modules + key: modules-${{ hashFiles('yarn.lock') }} - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: yarn install - name: Build Module diff --git a/.github/workflows/publish_unit_tests_job.yml b/.github/workflows/publish_unit_tests_job.yml index 82f2959a..eed240dc 100644 --- a/.github/workflows/publish_unit_tests_job.yml +++ b/.github/workflows/publish_unit_tests_job.yml @@ -27,7 +27,7 @@ jobs: uses: actions/download-artifact@v3 with: name: eslint_report - path: eslint_report.json + path: . - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v2 @@ -43,14 +43,8 @@ jobs: min-line-coverage: 50 min-method-coverage: 50 - # - name: Annotate Code Linting Results - # uses: ataylorme/eslint-annotate-action@v2 - # with: - # repo-token: "${{ secrets.GITHUB_TOKEN }}" - # report-json: "eslint_report.json" - - # - name: Upload ESLint report - # uses: actions/upload-artifact@v3 - # with: - # name: eslint_report.json - # path: eslint_report.json + - name: Annotate Code Linting Results + uses: ataylorme/eslint-annotate-action@v2 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + report-json: "eslint_report.json" diff --git a/.github/workflows/test_job.yml b/.github/workflows/test_job.yml index 62737abf..a6387295 100644 --- a/.github/workflows/test_job.yml +++ b/.github/workflows/test_job.yml @@ -15,7 +15,15 @@ jobs: with: node-version-file: '.nvmrc' + - name: Cache yarn dependencies + id: cache + uses: actions/cache@v3 + with: + path: ./node_modules + key: modules-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: yarn install - name: Run Jest diff --git a/scripts/CampaignRenderer.ts b/scripts/CampaignRenderer.ts index 0b8ab000..3537d8fb 100644 --- a/scripts/CampaignRenderer.ts +++ b/scripts/CampaignRenderer.ts @@ -30,6 +30,7 @@ class CampaignRenderer { // Get unique EventIds const eventIds = [] .concat( + // eslint-disable-next-line no-unsafe-optional-chaining ...statList?.map((m) => m.data.map((im) => { return im.EventName; @@ -197,6 +198,7 @@ class CampaignRenderer { const flattenedResults = [] .concat( + // eslint-disable-next-line no-unsafe-optional-chaining ...statList?.map((m) => m.data?.map((im) => { return im?.actorName; diff --git a/scripts/SetupHooksPF2e.ts b/scripts/SetupHooksPF2e.ts index c600c52f..958c893c 100644 --- a/scripts/SetupHooksPF2e.ts +++ b/scripts/SetupHooksPF2e.ts @@ -12,7 +12,6 @@ import { import StatManager from "./StatManager"; import { CombatDetailType, ChatType } from "./enums"; import Stat from "./stats/Stat"; -import Logger from "./Helpers/Logger"; import PF2e from "./parsers/PF2e"; export default class SetupHooksPF2e { diff --git a/scripts/types/CampaignRenderer.d.ts b/scripts/types/CampaignRenderer.d.ts index a521c4fe..253211a0 100644 --- a/scripts/types/CampaignRenderer.d.ts +++ b/scripts/types/CampaignRenderer.d.ts @@ -7,7 +7,7 @@ interface CampaignRender { fumbleHistory: Array; healsHistory: Array; killsHistory: Array; - rollstreak: Array; + rollstreak: Array | undefined; customEventHistory: Array | undefined; } From afb0f8fa9a5eef64cfca2bf59b69507fb7436bfb Mon Sep 17 00:00:00 2001 From: John Nolan Date: Mon, 12 Dec 2022 20:48:50 +0000 Subject: [PATCH 2/3] Create release files on publish --- .github/workflows/main_workflow.yml | 18 +----- .github/workflows/release_workflow.yml | 81 ++++++++++++++++++++++++++ CHANGELOG.md | 5 ++ 3 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/release_workflow.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/main_workflow.yml b/.github/workflows/main_workflow.yml index b3fea390..cd8ea37f 100644 --- a/.github/workflows/main_workflow.yml +++ b/.github/workflows/main_workflow.yml @@ -70,23 +70,8 @@ jobs: env: REPO: ${{ github.repository }} - # Substitute the Manifest and Download URLs in the module.json - - name: Substitute Manifest and Download Links For Versioned Ones - id: sub_manifest_link_version - uses: microsoft/variable-substitution@v1 - with: - files: 'module.json' - env: - version: ${{steps.bump_version.outputs.new_tag}} - url: https://github.com/${{github.repository}} - manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json - download: https://github.com/${{github.repository}}/releases/download/${{steps.bump_version.outputs.new_tag}}/module.zip - - # Create a zip file with all files required by the module to add to the release - - run: zip -r ./module.zip module.json LICENSE dist/ languages/ styles/ templates/ packs/ - # Create a release for this specific version - - name: Update Release with Files + - name: Create Release id: create_version_release uses: ncipollo/release-action@v1 with: @@ -95,6 +80,5 @@ jobs: draft: false prerelease: true token: ${{ secrets.GITHUB_TOKEN }} - artifacts: './module.json, ./module.zip' tag: ${{ steps.bump_version.outputs.new_tag }} body: ${{ steps.changelog.outputs.changelog }} diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml new file mode 100644 index 00000000..5f68ddc9 --- /dev/null +++ b/.github/workflows/release_workflow.yml @@ -0,0 +1,81 @@ +name: "[Workflow] Release" + +on: + release: + types: [published] + +jobs: + create_changelog_commit: + name: Create and commit Changelog + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.tag_name }} + release-notes: ${{ github.event.release.body }} + + - name: Commit updated CHANGELOG + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: ${{ github.event.release.target_commitish }} + commit_message: Update CHANGELOG + file_pattern: CHANGELOG.md + + create_tag_publish: + name: Build assets and Publish to release + runs-on: ubuntu-latest + permissions: + contents: write + needs: ['create_changelog_commit'] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + + - name: Cache yarn dependencies + id: cache + uses: actions/cache@v3 + with: + path: ./node_modules + key: modules-${{ hashFiles('yarn.lock') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: yarn install + + - name: Build Module + run: yarn run build + + # Substitute the Manifest and Download URLs in the module.json + - name: Substitute Manifest and Download Links For Versioned Ones + id: sub_manifest_link_version + uses: microsoft/variable-substitution@v1 + with: + files: 'module.json' + env: + version: ${{github.event.release.tag_name}} + url: https://github.com/${{github.repository}} + manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json + download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip + + # Create a zip file with all files required by the module to add to the release + - run: zip -r ./module.zip module.json CHANGELOG.md LICENSE dist/ languages/ templates/ packs/ + + # Create a release for this specific version + - name: Update Release with Files + id: create_version_release + uses: ncipollo/release-action@v1 + with: + name: ${{ github.event.release.tag_name }} + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: './module.json, ./module.zip' diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..e137b179 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +## 2.6.4 + +- [PATCH] Update verified version and remove debug code From 7bff562f735322a06a54df9eeb3bd8881838e833 Mon Sep 17 00:00:00 2001 From: John Nolan Date: Mon, 12 Dec 2022 21:08:24 +0000 Subject: [PATCH 3/3] Simplify renovate config --- renovate.json | 52 +++++++-------------------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/renovate.json b/renovate.json index 261e0dc4..f3521cc9 100644 --- a/renovate.json +++ b/renovate.json @@ -1,49 +1,11 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:base" - ], - "branchPrefix": "renovate-", - "commitMessageAction": "Renovate Update", - "labels": [ - "Dependencies", - "Renovate" - ], - "lockFileMaintenance": { - "enabled": true - }, - "packageRules": [ - { - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "all non-major dependencies", - "groupSlug": "all-minor-patch", - "automerge": true, - "labels": ["dependencies"] - }, - { - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["major"], - "labels": ["dependencies", "breaking"] - }, - { - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["digest"], - "groupName": "all digests", - "groupSlug": "all-digest-patch", - "automerge": true, - "schedule": ["before 3am on Monday"], - "labels": ["digest"] - } - ], - "vulnerabilityAlerts": { - "groupName": "Vulnerability Patches", - "dependencyDashboardApproval": false, - "stabilityDays": 0, - "rangeStrategy": "update-lockfile", - "commitMessagePrefix": "[SECURITY]", - "branchTopic": "{{{datasource}}}-{{{depName}}}-vulnerability", - "prCreation": "immediate", - "prPriority": 2 - } + "config:base", + "schedule:daily", + ":pinAllExceptPeerDependencies", + ":automergeAll", + "npm:unpublishSafe", + "group:all" + ] } \ No newline at end of file