Skip to content

feat: Support for Management API CLI #14

feat: Support for Management API CLI

feat: Support for Management API CLI #14

Workflow file for this run

name: Build and Deploy to AWS S3
on:
pull_request:
branches:
- master # Trigger on PRs targeting 'master' branch
types:
- open
- synchronize
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC
contents: read # Required to fetch repo contents
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
# Step 3: Install dependencies
- name: Install dependencies
run: npm ci --include=dev
# Step 4: Build the project
- name: Build package
run: npm run build
# Step 5: Configure AWS credentials via OIDC
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: ${{ secrets.AWS_S3_ARN }}
# aws-region: ap-southeast-2
# mask-aws-account-id: true
# # Step 6: Upload to S3
# - name: Upload to S3
# run: |
# aws s3 cp ./dist s3://universal-login-sample-app/ --recursive
- name: Manually create test folders under dist/ (for testing only)
run: |
mkdir -p dist/loginid
mkdir -p dist/login
# Copy the existing built files into these folders
cp dist/index.js dist/loginid/index.js
cp dist/index.css dist/loginid/index.css
cp dist/index.html dist/loginid/index.html
cp dist/*.png dist/loginid/
cp dist/index.js dist/login/index.js
cp dist/index.css dist/login/index.css
cp dist/index.html dist/login/index.html
cp dist/*.png dist/login/
echo "Created test folders with copied build files:"
ls -R dist/
- name: Generate settings JSON files dynamically
run: |
for screen_folder in dist/*; do
if [ -d "$screen_folder" ]; then
screen_name=$(basename "$screen_folder")
cat > "$screen_name-settings.json"
{
"rendering_mode": "advanced",
"context_configuration": [
"screen.texts",
"screen.hasCaptcha",
"screen.captchaImage"
],
"head_tags": [
{
"tag": "script",
"attributes": {
"src": "\$CDN_URL/$screen_name/index.js",
"integrity": "sha384-\$jsHash",
"crossorigin": "anonymous"
}
},
{
"tag": "link",
"attributes": {
"href": "\$CDN_URL/$screen_name/index.css",
"rel": "stylesheet",
"integrity": "sha384-\$cssHash",
"crossorigin": "anonymous"
}
}
]
}
echo "Generated settings file: $screen_name-settings.json"
fi
done
- name: Update Management API using Auth0 CLI
run: |
for screen_folder in dist/*; do
if [ -d "$screen_folder" ]; then
screen_name=$(basename "$screen_folder")
auth0 ui customize --rendering-mode advanced --prompt login-id --screen $screen_name --settings-file "./$screen_name-settings.json"
echo "Updated Auth0 UI for screen: $screen_name"
fi
done