Skip to content

fix parseInt

fix parseInt #18

name: Deploy Experience Builder Apps
on:
push:
branches:
- master
jobs:
Deploy-Experience-Builder-Apps:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download Experience Builder
run: npx arcgis-lib-downloader -p arcgis-experience-builder -v 1.13 -t Download
env:
ARCGIS_LIB_DOWNLOADER_USERNAME: ${{ secrets.ARCGIS_LIB_DOWNLOADER_USERNAME }}
ARCGIS_LIB_DOWNLOADER_PASSWORD: ${{ secrets.ARCGIS_LIB_DOWNLOADER_PASSWORD }}
- name: Unzip Experience Builder
run: unzip -q arcgis-experience-builder-1.13.zip -d arcgis-experience-builder-1.13
- name: Copy Custom Widgets
run: cp -r widgets/* arcgis-experience-builder-1.13/ArcGISExperienceBuilder/client/your-extensions/widgets
- name: Install Custom Widgets dependencies
run: node npm-install-subfolders.js ./arcgis-experience-builder-1.13/ArcGISExperienceBuilder/client/your-extensions/widgets
- name: Create App directory
run: mkdir public && cd public && mkdir apps && cd apps
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder/server
- name: Copy apps
run: cp -r apps/* arcgis-experience-builder-1.13/ArcGISExperienceBuilder/server/public/apps
- name: Read apps/2/download-times.json
id: download-times-app-2
uses: jaywcjlove/github-action-read-file@main
with:
path: apps/2/download-times.json
- name: Echo download-times-app-2
run: echo "${{ steps.download-times-app-2.outputs.content }}"
- name: Echo download-times-app-2-1
# the next line generate the error invalid arithmetic operator
# run: echo $((steps.download-times-app-2.outputs.content + 1))
run: echo $(( parseInt(${steps.download-times-app-2.outputs.content}) + 1 ))
- name: Output download-times-app-2
id: output-download-times-app-2
run: echo "::set-output name=downloadTimes::${{ steps.download-times-app-2.outputs.content }}"
- name: Echo modified download-times-app-2
run: echo "${{ steps.output-download-times-app-2.outputs.downloadTimes }} + 1"
- name: Modify apps/2/download-times.json
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: apps/2/download-times.json
body: "${{ steps.download-times-app-2.outputs.content }} + 1"
- name: NPM install client folder
run: npm ci
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder/client
- name: NPM install in server folder
run: npm ci
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder/server
- name: Build widgets
run: npm run build:prod
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder/client
- name: Run download script
# include clientId of the app, as explained here: https://community.esri.com/t5/arcgis-experience-builder-blog/experience-builder-devops-generating-the-app/ba-p/1112247
run: node -e "require('./server/src/middlewares/dev/apps/app-download.js').zipApp('2', 'app.zip', 'pSM9aNISD0wgzyXA')"
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder
env:
NODE_ENV: production
- name: Unzip app zip
# ExB has non-standard file permissions so use chmod after unzip
run: |
unzip -q app.zip -d app
chmod -R 777 app
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder
- name: Generate screenshot (optional)
working-directory: arcgis-experience-builder-1.13/ArcGISExperienceBuilder/app
continue-on-error: true
run: |
npm install --global pageres-cli
npm install --global serve
echo "{\"trailingSlash\":true}" > serve.json
serve . -p 5000 &
pageres http://localhost:5000/index.html 1024x768 --filename=screenshot --delay=10
- name: Deploy app zip to GH Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: arcgis-experience-builder-1.13/ArcGISExperienceBuilder/app