Skip to content

Commit

Permalink
Adds deploy script (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
madsnedergaard authored Nov 4, 2022
1 parent a62aab7 commit 4376709
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.codeActionsOnSave": ["source.addMissingImports", "source.fixAll", "source.organizeImports"],
"editor.codeActionsOnSave": ["source.addMissingImports", "source.fixAll.eslint", "source.organizeImports"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2,
Expand Down
28 changes: 28 additions & 0 deletions web/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

BUCKET_NAME="gs://beta.electricitymaps.com"

echo "Starting deployment..."

#Create bucket (already done):
# gsutil mb -p tmrow-152415 -c regional -l europe-west1 $BUCKET_NAME

# Upload files and set proper index page
gsutil -h "Cache-Control:public,max-age=0" -m cp -a public-read -r dist/* $BUCKET_NAME
gsutil web set -m index.html -e 404.html $BUCKET_NAME

# Unsure if this is required, but we have used it before...
# Save the following to cors-config.json and enable command below
# [{"maxAgeSeconds": 3600,"method": ["GET", "HEAD"],"origin": ["*"],"responseHeader": ["Content-Type"]}]
# gsutil cors set cors-config.json $BUCKET_NAME

# Set no-cache for certain files if required
#gsutil setmeta -h "Cache-Control:no-cache,max-age=0" $BUCKET_NAME/*.json

# Create new git tag and Github release
VERSION=$(pnpm version prerelease --preid=beta)
git tag -a $VERSION -m "$VERSION"
git push origin $VERSION
gh release create $VERSION --generate-notes --prerelease --repo electricitymaps/electricitymaps-contrib-rewrite

echo "Done!"
5 changes: 3 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electricitymap-web",
"version": "2.0.0",
"version": "1.1.0-beta.1",
"description": "A real-time visualisation of the CO2 emissions of electricity consumption",
"license": "GPL-3.0-or-later",
"engines": {
Expand All @@ -24,7 +24,8 @@
"run-tsc": "tsc",
"run-eslint": "eslint --cache --fix --ignore-path .gitignore --ext .ts,.tsx .",
"lint": "run-p run-tsc run-eslint",
"validate": "run-p lint test:ci test:e2e:headless"
"validate": "run-p lint test:ci test:e2e:headless",
"deploy": "pnpm build && sh deploy.sh"
},
"dependencies": {
"@tanstack/react-query": "4.13.0",
Expand Down

0 comments on commit 4376709

Please sign in to comment.