Skip to content

Update OPENHISTORICALMAP_WEBSITE_GITSHA #1228

Update OPENHISTORICALMAP_WEBSITE_GITSHA

Update OPENHISTORICALMAP_WEBSITE_GITSHA #1228

name: Build and Publish tasking-manager site
on:
push:
branches:
- 'main'
- 'staging'
- 'tm-fix-version'
jobs:
tm:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Set environment variables - Staging
if: github.ref == 'refs/heads/staging'
uses: allenevans/[email protected]
with:
TM_APP_BASE_URL: https://tasks-staging.openhistoricalmap.org
TM_APP_API_URL: https://tm-api.staging.openhistoricalmap.org
TM_APP_API_VERSION: v2
TM_ORG_NAME: OpenHistoricalMap
TM_ORG_CODE: OHM
TM_ORG_URL: openhistoricalmap.org
TM_ORG_PRIVACY_POLICY_URL: staging.openhistoricalmap.org/copyright
TM_ORG_TWITTER: http://twitter.com/OpenHistMap
TM_ORG_GITHUB: github.com/openhistoricalmap
TM_CONSUMER_KEY: CGWeUmRTFb6o0OQy4AyXb8bnl5fuSdCPODknveW7
TM_CONSUMER_SECRET: lIVcx44V97QqgTSbXeJw5EKAdIBZrJ2N5negJsF4
OSM_SERVER_URL: https://staging.openhistoricalmap.org
OSM_REGISTER_URL: https://staging.openhistoricalmap.org/user/new
ID_EDITOR_URL: https://staging.openhistoricalmap.org/edit?editor=id
POTLATCH2_EDITOR_URL: https://staging.openhistoricalmap.org/edit?editor=potlatch2
TM_MAX_AOI_AREA: 15000
TM_IMPORT_MAX_FILESIZE: 3e+06
AWS_S3_BUCKET: tasks-staging.openhistoricalmap.org
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_TM_CLOUDFRONT_DISTRIBUTION_ID }}
- name: Set environment variables - Production
if: github.ref == 'refs/heads/main'
uses: allenevans/[email protected]
with:
TM_APP_BASE_URL: https://tasks.openhistoricalmap.org
TM_APP_API_URL: https://tm-api.openhistoricalmap.org
TM_APP_API_VERSION: v2
TM_ORG_NAME: OpenHistoricalMap
TM_ORG_CODE: OHM
TM_ORG_URL: www.openhistoricalmap.org
TM_ORG_PRIVACY_POLICY_URL: www.openhistoricalmap.org/copyright
TM_ORG_TWITTER: http://twitter.com/OpenHistMap
TM_ORG_GITHUB: github.com/openhistoricalmap
TM_CONSUMER_KEY: ${{ secrets.PRODUCTION_TM_API_CONSUMER_KEY }}
TM_CONSUMER_SECRET: ${{ secrets.PRODUCTION_TM_API_CONSUMER_SECRET }}
OSM_SERVER_URL: https://www.openhistoricalmap.org
OSM_REGISTER_URL: https://www.openhistoricalmap.org/user/new
ID_EDITOR_URL: https://www.openhistoricalmap.org/edit?editor=id
POTLATCH2_EDITOR_URL: https://www.openhistoricalmap.org/edit?editor=potlatch2
TM_MAX_AOI_AREA: 15000
TM_IMPORT_MAX_FILESIZE: 3e+06
AWS_S3_BUCKET: tasks.openhistoricalmap.org
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.PRODUCTION_TM_CLOUDFRONT_DISTRIBUTION_ID }}
- name: Checkout tasking-manager repo
uses: actions/checkout@v2
with:
repository: OpenHistoricalMap/tasking-manager
ref: 3902d566d9d2d8d5a9c37bf61894ed649b581ee5
# token: ${{ env.DEV_GITHUB_TOKEN }}
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: '12'
- name: npm Install
run: |
cat package.json
npm install
npm install @openhistoricalmap/[email protected]
npm install @babel/core@^7.16.0 --save-dev
npm run build
working-directory: frontend
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install aws cli
run: |
python -m pip install --upgrade pip
pip install awscli
- name: Sync to S3 and clean cache in cloudfront
if: ${{ success() }}
run: |
aws s3 sync frontend/build s3://${AWS_S3_BUCKET} --acl public-read --delete
aws cloudfront create-invalidation --distribution-id=${CLOUDFRONT_DISTRIBUTION_ID} --paths=/
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}