Skip to content

Commit

Permalink
chore: upload bundle to cdn (#177)
Browse files Browse the repository at this point in the history
* chore: update preVersion in webtask.json

* upload bundle in deploy step

* update webtask deploy tool url

* temporarily run build workflow on dev branch

* fix small typo

* remove existence check to test uploading

* re-add existence check
  • Loading branch information
bernardwolff authored Jan 8, 2025
1 parent 9029d89 commit 76375e6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Update the configuration file under `./server/config.json`:
Then you can run the extension:

```bash
nvm use 8
nvm use 10
yarn install
yarn run build
yarn run serve:dev
Expand All @@ -48,14 +48,14 @@ yarn test

## Release Process

Deployment is currently done using this tool: https://auth0-extensions.us8.webtask.io/extensions-deploy
Deployment is currently done using this tool: https://auth0-extensions.us.webtask.io/extensions-deploy

First bump the version in `package.json` and in `webtask.json`

Then build the extension:

```bash
nvm use 8
nvm use 10
yarn install
yarn run build
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Auth0 Account Link Extension",
"main": "index.js",
"engines": {
"node": ">=6.9"
"node": ">=10"
},
"scripts": {
"start": "node ./index.js",
Expand Down
16 changes: 12 additions & 4 deletions tools/cdn.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
CURRENT_VERSION=$(node tools/attribute.js version)
EXTENSION_NAME="auth0-account-link"

BUNDLE_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/ | grep "$EXTENSION_NAME-$CURRENT_VERSION.js")
CDN_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/ | grep "link.$CURRENT_VERSION.min.css")
ADMIN_CDN_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/ | grep "admin.$CURRENT_VERSION.min.css")

if [ ! -z "$BUNDLE_EXISTS" ]; then
echo "There is already a $EXTENSION_NAME-$CURRENT_VERSION.js in the cdn. Skipping cdn publish…"
else
aws s3 cp build/bundle.js s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/$EXTENSION_NAME-$CURRENT_VERSION.js --region us-west-1 --acl public-read
echo "$EXTENSION_NAME-$CURRENT_VERSION.js uploaded to the cdn"
fi

if [ ! -z "$CDN_EXISTS" ]; then
echo "There is already a version $CURRENT_VERSION in the cdn. Skipping cdn publish…"
echo "There is already a link.$CURRENT_VERSION.min.css in the cdn. Skipping cdn publish…"
else
aws s3 cp dist/assets/link.$CURRENT_VERSION.min.css s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/link.$CURRENT_VERSION.min.css --region us-west-1 --cache-control "max-age=86400" --acl public-read
echo "$CURRENT_VERSION uploaded to the cdn"
echo "link.$CURRENT_VERSION.min.css uploaded to the cdn"
fi

if [ ! -z "$ADMIN_CDN_EXISTS" ]; then
echo "There is already a version $CURRENT_VERSION in the cdn. Skipping cdn publish…"
echo "There is already a admin.$CURRENT_VERSION.min.css in the cdn. Skipping cdn publish…"
else
aws s3 cp dist/assets/admin.$CURRENT_VERSION.min.css s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/admin.$CURRENT_VERSION.min.css --region us-west-1 --cache-control "max-age=86400" --acl public-read
echo "$CURRENT_VERSION uploaded to the cdn"
echo "admin.$CURRENT_VERSION.min.css uploaded to the cdn"
fi
2 changes: 1 addition & 1 deletion webtask.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Auth0 Account Link",
"name": "auth0-account-link",
"version": "2.6.6",
"preVersion": "2.6.3",
"preVersion": "2.6.5",
"author": "auth0",
"description":
"This extension gives Auth0 customers the ability to allow their users to link their accounts",
Expand Down

0 comments on commit 76375e6

Please sign in to comment.