diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7997e81..5b36e7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,10 @@ on: release: types: [published] +env: + package_name: Tagger + package_id: tagger + jobs: build: runs-on: ubuntu-latest @@ -39,8 +43,6 @@ jobs: manifest: https://raw.githubusercontent.com/${{github.repository}}/next/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 LICENSE style.css scripts/ @@ -59,6 +61,62 @@ jobs: tag: ${{ github.event.release.tag_name }} body: ${{ github.event.release.body }} + - name: Get Compatibility + if: "!github.event.release.prerelease" + run: | + echo 'COMPATIBILITY<> $GITHUB_ENV + cat module.json | jq .compatibility >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + + - name: Send package to foundry + if: "!github.event.release.prerelease" + run: | + HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST 'https://api.foundryvtt.com/_api/packages/release_version/' \ + --header 'Authorization: ${{ secrets.PACKAGE_TOKEN }}' \ + --header 'Content-Type: application/json' \ + --data '{ + "id": "${{env.package_id}}", + "release": { + "version": "${{ github.event.release.tag_name }}", + "manifest": "https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.json", + "notes": "https://github.com/${{github.repository}}/releases/tag/${{github.event.release.tag_name}}", + "compatibility": ${{ env.COMPATIBILITY }} + } + }') + + # extract the body + HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g') + + # extract the status + HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') + + # print the body + echo "$HTTP_BODY" + + # example using the status + if [ ! $HTTP_STATUS -eq 200 ]; then + echo "Error [HTTP status: $HTTP_STATUS]" + exit 1 + fi + + - name: FC Discord notification + if: "!github.event.release.prerelease" + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + DISCORD_USERNAME: ${{env.package_name}} Version ${{github.event.release.tag_name}} + uses: Ilshidur/action-discord@master + with: + args: "${{github.event.release.body}}" + + - name: JB2A Discord notification + if: "!github.event.release.prerelease" + env: + DISCORD_WEBHOOK: ${{ secrets.JB2A_WEBHOOK_URL }} + DISCORD_USERNAME: ${{env.package_name}} Version ${{github.event.release.tag_name}} + uses: Ilshidur/action-discord@master + with: + args: "${{github.event.release.body}}" + # OR create a pre-release for this specific version - name: Update Release with Files if: "github.event.release.prerelease" diff --git a/module.json b/module.json index a7a0d6f..7d09930 100644 --- a/module.json +++ b/module.json @@ -22,10 +22,7 @@ "styles": [ "./style.css" ], - "socket": false, - "protected": false, - "coreTranslation": false, - "library": "false", + "library": true, "url": "https://github.com/fantasycalendar/FoundryVTT-Tagger", "manifest": "https://github.com/fantasycalendar/FoundryVTT-Tagger/releases/latest/download/module.json", "download": "https://github.com/fantasycalendar/FoundryVTT-Tagger/releases/latest/download/module.zip", diff --git a/scripts/module.js b/scripts/module.js index 3271345..d91ed08 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -280,6 +280,7 @@ export default class Tagger { ...Array.from(scene.walls), ...Array.from(scene.drawings), ...Array.from(scene.notes), + ...Array.from(scene.regions), ].deepFlatten().filter(Boolean) } @@ -415,6 +416,12 @@ class TaggerConfig { this._applyHtml(app, elem, true); } + static _handleRegionConfig(app, html) { + const jqueryHtml = $(html); + const elem = jqueryHtml.find(`section[data-tab="identity"]`); + this._applyHtml(app, elem); + } + static _handleGenericConfig(app, html) { const jqueryHtml = $(html); let button = jqueryHtml.find(`button[name="submit"]`); @@ -810,10 +817,11 @@ const configHandlers = { "TileConfig": "_handleTileConfig", "DrawingConfig": "_handleDrawingConfig", "AmbientLightConfig": "_handleAmbientLightConfig", // v12 + "RegionConfig": "_handleRegionConfig", "WallConfig": "_handleGenericConfig", "AmbientSoundConfig": "_handleGenericConfig", "MeasuredTemplateConfig": "_handleGenericConfig", - "NoteConfig": "_handleGenericConfig" + "NoteConfig": "_handleGenericConfig", } for (const [configName, configHandler] of Object.entries(configHandlers)) { @@ -822,7 +830,7 @@ for (const [configName, configHandler] of Object.entries(configHandlers)) { }); } -for (const obj of ["Actor", "Token", "Tile", "Drawing", "Wall", "Light", "AmbientLight", "AmbientSound", "MeasuredTemplate", "Note"]) { +for (const obj of ["Actor", "Token", "Tile", "Drawing", "Wall", "AmbientLight", "AmbientSound", "MeasuredTemplate", "Note", "Region"]) { Hooks.on(`preUpdate${obj}`, (...args) => TaggerHandler.applyUpdateTags(...args)); Hooks.on(`preCreate${obj}`, (...args) => TaggerHandler.preCreateApplyTags(...args)); } diff --git a/style.css b/style.css index 6451e57..f3676be 100644 --- a/style.css +++ b/style.css @@ -1,5 +1,6 @@ fieldset.tagger { margin: 5px 0; + flex: auto; } fieldset.tagger .tag-container { display: flex; @@ -7,9 +8,9 @@ fieldset.tagger .tag-container { } fieldset.tagger .tag-container .tag { padding: 5px 5px 5px 8px; - border: 1px solid #9b9b9b; - margin: 3px 3px 3px 0; + border: 1px solid rgb(155, 155, 155); color: black; + margin: 3px 3px 3px 0; display: flex; align-items: center; border-radius: 5px; diff --git a/style.css.map b/style.css.map index 45e6915..3037a80 100644 --- a/style.css.map +++ b/style.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["style.scss"],"names":[],"mappings":"AAAA;EACE;;AAEA;EAEE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAIA;EACE;;AAIJ;EACE;EACA;;AAEA;EACE;;AAIJ;EACE;;AAGF;EACE;;AAQJ;EACE;EACA;EACA;EACA;EACA;EACA","file":"style.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["style.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;AAEA;EAEE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAIA;EACE;;AAIJ;EACE;EACA;;AAEA;EACE;;AAIJ;EACE;;AAGF;EACE;;AAQJ;EACE;EACA;EACA;EACA;EACA;EACA","file":"style.css"} \ No newline at end of file diff --git a/style.scss b/style.scss index ed68946..61b565a 100644 --- a/style.scss +++ b/style.scss @@ -1,5 +1,6 @@ fieldset.tagger { margin: 5px 0; + flex: auto; .tag-container {