diff --git a/.github/workflows/aws-publish.yml b/.github/workflows/aws-publish.yml index 46948cc..502a880 100644 --- a/.github/workflows/aws-publish.yml +++ b/.github/workflows/aws-publish.yml @@ -1,8 +1,11 @@ name: Build and Deploy to AWS S3 on: - push: + pull_request: branches: - master # Trigger on PRs targeting 'master' branch + types: + - open + - synchronize workflow_dispatch: jobs: @@ -43,4 +46,87 @@ jobs: # Step 6: Upload to S3 - name: Upload to S3 run: | - aws s3 cp ./dist s3://universal-login-sample-app/ --recursive \ No newline at end of file + 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: Install jq (if not available) + # run: sudo apt-get install jq -y + + # - name: Generate settings JSON files dynamically + # run: | + # for screen_folder in dist/*; do + # if [ -d "$screen_folder" ]; then + # screen_name=$(basename "$screen_folder") + # jq -n --arg screen_name "$screen_name" \ + # --arg cdn_url "${{ secrets.CDN_URL }}" \ + # --arg js_hash "$jsHash" \ + # --arg css_hash "$cssHash" \ + # '{ + # "rendering_mode": "advanced", + # "context_configuration": [ + # "branding.settings", + # "branding.themes.default" + # ], + # "head_tags": [ + # { + # "tag": "script", + # "attributes": { + # "src": ($cdn_url + "/" + $screen_name + "/index.js"), + # "integrity": [("sha384-" + $js_hash)], + # "crossorigin": "anonymous" + # } + # }, + # { + # "tag": "link", + # "attributes": { + # "href": ($cdn_url + "/" + $screen_name + "/index.css"), + # "rel": "stylesheet", + # "integrity": [("sha384-" + $css_hash)], + # "crossorigin": "anonymous" + # } + # } + # ] + # }' > "$screen_name-settings.json" + # echo "Generated settings file: $screen_name-settings.json" + # cat "$screen_name-settings.json" + # fi + # done + + # - name: Install Auth0 CLI + # run: | + # # Download and install Auth0 CLI + # curl -sSfL https://raw.githubusercontent.com/auth0/auth0-cli/main/install.sh | sh -s -- -b . + # # Move it to /usr/local/bin for system-wide access + # sudo mv ./auth0 /usr/local/bin/ + + # - name: Authorize with Tenant Details + # run: | + # auth0 login \ + # --domain ${{ secrets.AUTH0_DOMAIN }} \ + # --client-id ${{ secrets.AUTH0_CLIENT_ID }} \ + # --client-secret ${{ secrets.AUTH0_CLIENT_SECRET }} + + # - 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 ul 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 \ No newline at end of file