testing the build process #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Build-and-Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Download Experience Builder | |
# WARNING: | |
# THIS METHOD OF DOWNLOADING EXPERIENCE BUILDER MAY BREAK IF ESRI CHANGES HOW DOWNLOADS WORK IN THE FUTURE. | |
# IN OTHER WORDS, IT COULD BREAK AT ANY TIME. | |
# THERE IS NO WARRANTY OR GUARANTEE THAT THIS COMMAND WILL WORK IN THE FUTURE. | |
# ONLY USE THIS COMMAND IF YOU UNDERSTAND HOW IT IS BEING USED AND ARE COMFORTABLE FIXING IT IF IT BREAKS: | |
run: curl -o exb.zip "$(curl -s 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.13.zip?f=json&folder=software%2FExperienceBuilder%2F1.13' | python3 -c "import sys, json; print(json.load(sys.stdin)['url'])")" | |
- name: Unzip Experience Builder | |
run: unzip -q exb.zip -d exb | |
- name: Copy Custom Widgets | |
run: cp -r widgets/* exb/ArcGISExperienceBuilder/client/your-extensions/widgets | |
- name: Create App directory | |
run: mkdir public && cd public && mkdir apps && cd apps | |
working-directory: exb/ArcGISExperienceBuilder/server | |
- name: Copy apps | |
run: cp -r apps/* exb/ArcGISExperienceBuilder/server/public/apps | |
- name: NPM install client folder | |
run: npm ci | |
working-directory: exb/ArcGISExperienceBuilder/client | |
- name: NPM install in server folder | |
run: npm ci | |
working-directory: exb/ArcGISExperienceBuilder/server | |
- name: Build widgets | |
run: npm run build:prod | |
working-directory: exb/ArcGISExperienceBuilder/client | |
- name: Run download script | |
run: node -e "require('./server/src/middlewares/dev/apps/app-download.js').zipApp('0', 'app.zip')" | |
working-directory: exb/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: exb/ArcGISExperienceBuilder | |
- name: Generate screeenshot (optional) | |
working-directory: exb/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: exb/ArcGISExperienceBuilder/app |