From 774a94ea16b5b55844d917a1ca36c07e0c4536ab Mon Sep 17 00:00:00 2001 From: weaponsforge Date: Wed, 28 Aug 2024 12:59:59 +0800 Subject: [PATCH] fix: display images on npm --- .github/workflows/release.yml | 2 ++ README.md | 1 + app/.env.example | 3 ++- scripts/npm-publish.sh | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de0cca9..33afbcb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -117,6 +117,8 @@ jobs: name: Publish to NPM registry runs-on: ubuntu-latest needs: build-on-win + env: + IMAGE_URL: ${{ secrets.IMAGE_URL }} steps: - name: Checkout the repository uses: actions/checkout@v3 diff --git a/README.md b/README.md index cac376f..b18b3cb 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ The following dependencies are used for this project. Feel free to use other dep | SHEETJS_COLUMN | Column name read by [sheetjs](https://sheetjs.com/) in an excel file.
This column contains the municipality and province names following the string pattern
`"municipalityName (provinceName)"`
Default value is `__EMPTY`| | SORT_ALPHABETICAL | Arranges the municipality names in alphabetical order.
Default value is `1`. Set to `0` to use the ordering as read from the Excel file. | | SPECIAL_CHARACTERS | Key-value pairs of special characters or garbled text and their normalized text conversions, delimited by the `":"` character.
Multiple key-value pairs are delimited by the `","` character.
If a special character key's value is a an empty string, write it as i.e.,: `"some-garbled-text:"` | + | IMAGE_URL | Raw URL of the README image file from this GitHub repository.
**NOTE:** Only add this variable in the GitHub Secrets for publishing to the NPM registry since NPM does not allow displaying images by relative path.
| ## Installation Using Docker diff --git a/app/.env.example b/app/.env.example index a8661a9..8963766 100644 --- a/app/.env.example +++ b/app/.env.example @@ -2,4 +2,5 @@ EXCEL_FILE_URL=https://pubfiles.pagasa.dost.gov.ph/pagasaweb/files/climate/tenda DEFAULT_EXCEL_FILE_URL=https://pubfiles.pagasa.dost.gov.ph/pagasaweb/files/climate/tendayweatheroutlook/day1.xlsx SHEETJS_COLUMN=__EMPTY SORT_ALPHABETICAL=1 -SPECIAL_CHARACTERS=├â┬▒:ñ,â: \ No newline at end of file +SPECIAL_CHARACTERS=├â┬▒:ñ,â: +IMAGE_URL=https://raw.githubusercontent.com/ciatph/ph-municipalities/master/docs/diagrams/ph-municipalities-arch-90.png diff --git a/scripts/npm-publish.sh b/scripts/npm-publish.sh index fa08807..16a49b6 100644 --- a/scripts/npm-publish.sh +++ b/scripts/npm-publish.sh @@ -1,4 +1,4 @@ #!/bin/bash -sed "s|/docs/diagrams/||g" README.md > app/README.md -cp docs/diagrams/ph-municipalities-arch-90.png app/ +# Use image file from remote URL source since NPM does not allow displaying images by relative path +sed "s|/docs/diagrams/ph-municipalities-arch-90.png|${IMAGE_URL}|g" README.md > app/README.md