From 84a24793040e4125cfdc05ade9e7608ecb65437d Mon Sep 17 00:00:00 2001 From: Rolyzky <89662653+Rolyzky@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:26:08 -0400 Subject: [PATCH 1/8] ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com --- ...tic-web-apps-agreeable-stone-0b04a730f.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml diff --git a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml new file mode 100644 index 0000000..813b016 --- /dev/null +++ b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml @@ -0,0 +1,46 @@ +name: Azure Static Web Apps CI/CD + +on: + push: + branches: + - develop + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - develop + +jobs: + build_and_deploy_job: + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + runs-on: ubuntu-latest + name: Build and Deploy Job + steps: + - uses: actions/checkout@v3 + with: + submodules: true + lfs: false + - name: Build And Deploy + id: builddeploy + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_STONE_0B04A730F }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "/" # App source code path + api_location: "" # Api source code path - optional + output_location: "" # Built app content directory - optional + ###### End of Repository/Build Configurations ###### + + close_pull_request_job: + if: github.event_name == 'pull_request' && github.event.action == 'closed' + runs-on: ubuntu-latest + name: Close Pull Request Job + steps: + - name: Close Pull Request + id: closepullrequest + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_STONE_0B04A730F }} + action: "close" From fc545dc5dfbfd1ba665c5fbaba28dfd25197c4b5 Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Tue, 1 Oct 2024 16:49:20 -0400 Subject: [PATCH 2/8] Updated workflow for dev to account for environment variables --- ...tic-web-apps-agreeable-stone-0b04a730f.yml | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml index 813b016..2ec1281 100644 --- a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml +++ b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml @@ -1,46 +1,50 @@ -name: Azure Static Web Apps CI/CD - -on: - push: - branches: - - develop - pull_request: - types: [opened, synchronize, reopened, closed] - branches: - - develop - -jobs: - build_and_deploy_job: - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') - runs-on: ubuntu-latest - name: Build and Deploy Job - steps: - - uses: actions/checkout@v3 - with: - submodules: true - lfs: false - - name: Build And Deploy - id: builddeploy - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_STONE_0B04A730F }} - repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) - action: "upload" - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### - # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig - app_location: "/" # App source code path - api_location: "" # Api source code path - optional - output_location: "" # Built app content directory - optional - ###### End of Repository/Build Configurations ###### - - close_pull_request_job: - if: github.event_name == 'pull_request' && github.event.action == 'closed' - runs-on: ubuntu-latest - name: Close Pull Request Job - steps: - - name: Close Pull Request - id: closepullrequest - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_STONE_0B04A730F }} - action: "close" +name: Azure Static Web Apps CI/CD + +on: + push: + branches: + - develop + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - develop + +jobs: + build_and_deploy_job: + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + runs-on: ubuntu-latest + name: Build and Deploy Job + env: + GA: ${{ vars.GA_ID_DEV }} + ROOT_URL: ${{ vars.ROOT_URL_DEV }} + SEARCH_SERVICE: ${{ vars.SEARCH_SERVICE_URL_DEV }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true + lfs: false + - name: Build And Deploy + id: builddeploy + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_STONE_0B04A730F }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "/" # App source code path + api_location: "" # Api source code path - optional + output_location: "" # Built app content directory - optional + ###### End of Repository/Build Configurations ###### + + close_pull_request_job: + if: github.event_name == 'pull_request' && github.event.action == 'closed' + runs-on: ubuntu-latest + name: Close Pull Request Job + steps: + - name: Close Pull Request + id: closepullrequest + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_STONE_0B04A730F }} + action: "close" From f73db05f2776a28f4b8403f63bdf13d42df56fb7 Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Tue, 1 Oct 2024 16:51:58 -0400 Subject: [PATCH 3/8] Updated output location --- .../azure-static-web-apps-agreeable-stone-0b04a730f.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml index 2ec1281..4e1eae2 100644 --- a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml +++ b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml @@ -34,7 +34,7 @@ jobs: # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "/" # App source code path api_location: "" # Api source code path - optional - output_location: "" # Built app content directory - optional + output_location: "bar" # Built app content directory - optional ###### End of Repository/Build Configurations ###### close_pull_request_job: From 57afdd4f88ba241ae752a125f1eececc36089f2c Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Tue, 1 Oct 2024 16:53:49 -0400 Subject: [PATCH 4/8] Added default output location again --- .../azure-static-web-apps-agreeable-stone-0b04a730f.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml index 4e1eae2..bf668aa 100644 --- a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml +++ b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml @@ -34,7 +34,7 @@ jobs: # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "/" # App source code path api_location: "" # Api source code path - optional - output_location: "bar" # Built app content directory - optional + output_location: "/" # Built app content directory - optional ###### End of Repository/Build Configurations ###### close_pull_request_job: From 943843ccfbbe0abb1103bd2e127f094355e984ab Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Tue, 1 Oct 2024 21:40:03 -0400 Subject: [PATCH 5/8] Moving deploy assets to a dist folder --- ...e-static-web-apps-agreeable-stone-0b04a730f.yml | 2 +- .gitignore | 1 + gulpfile.js | 14 +++++++++++++- package.json | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml index bf668aa..e6b03ca 100644 --- a/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml +++ b/.github/workflows/azure-static-web-apps-agreeable-stone-0b04a730f.yml @@ -34,7 +34,7 @@ jobs: # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "/" # App source code path api_location: "" # Api source code path - optional - output_location: "/" # Built app content directory - optional + output_location: "/dist" # Built app content directory - optional ###### End of Repository/Build Configurations ###### close_pull_request_job: diff --git a/.gitignore b/.gitignore index 93457d2..f937756 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ node_modules npm-debug.log gulp-config.json config.conf +dist diff --git a/gulpfile.js b/gulpfile.js index 0c61b1c..21d903f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,7 +23,8 @@ let config = { }, dist: { cssPath: './bar/css', - jsPath: './bar/js' + jsPath: './bar/js', + deployPath: './dist', }, compilerPath: './src', packagesPath: './node_modules', @@ -180,6 +181,17 @@ gulp.task('js-inject-vars', (done) => { // All js-related tasks gulp.task('js', gulp.series('es-lint', 'js-build-header', 'js-build-header-full', 'js-inject-vars')); +gulp.task('move-homepage', () => { + return gulp.src('./index.html') + .pipe(gulp.dest(config.dist.deployPath)); +}); + +gulp.task('move-assets', () => { + return gulp.src('./bar/**/*') + .pipe(gulp.dest(`${config.dist.deployPath}/bar`)); +}); + +gulp.task('move-deploy', gulp.series('move-homepage', 'move-assets')); // // Rerun tasks when files change diff --git a/package.json b/package.json index f7c8df9..d2b843e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "prebuild": "npm install", - "build": "gulp default" + "build": "gulp default && gulp move-deploy" }, "devDependencies": { "@babel/cli": "^7.17.3", From dbdbe7361fd7fd15f486cac5573ee9361db83d16 Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Tue, 1 Oct 2024 21:41:04 -0400 Subject: [PATCH 6/8] Added robots.txt to files to be moved --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 21d903f..b7f0154 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -182,7 +182,7 @@ gulp.task('js-inject-vars', (done) => { gulp.task('js', gulp.series('es-lint', 'js-build-header', 'js-build-header-full', 'js-inject-vars')); gulp.task('move-homepage', () => { - return gulp.src('./index.html') + return gulp.src(['./index.html', './robots.txt']) .pipe(gulp.dest(config.dist.deployPath)); }); From 13d00daa9d2a39e2ee0d71dee4d18acf5c6287ec Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Wed, 2 Oct 2024 10:24:07 -0400 Subject: [PATCH 7/8] Updated compile to check for existence --- package-lock.json | 4 ++-- src/compile.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 43ce7d5..3bc7609 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ucf-header", - "version": "3.2.4", + "version": "3.2.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ucf-header", - "version": "3.2.4", + "version": "3.2.5", "devDependencies": { "@babel/cli": "^7.17.3", "@babel/core": "^7.17.5", diff --git a/src/compile.sh b/src/compile.sh index e4ed149..41cc927 100755 --- a/src/compile.sh +++ b/src/compile.sh @@ -3,7 +3,9 @@ set -o nounset set -x cd "$(dirname "$0")" -source ../config.conf +if [ -f ../config.conf ]; then + source ../config.conf +fi NOW=$(date +"%s") # Create temp files: From 0f6a23e5b85b9398da7aee36e9abf98ab59f0869 Mon Sep 17 00:00:00 2001 From: Rolyzky <89662653+Rolyzky@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:54:25 -0400 Subject: [PATCH 8/8] Update azure-static-web-apps-gray-ocean-0501b9d0f.yml Setting the environmental variables... --- .../workflows/azure-static-web-apps-gray-ocean-0501b9d0f.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/azure-static-web-apps-gray-ocean-0501b9d0f.yml b/.github/workflows/azure-static-web-apps-gray-ocean-0501b9d0f.yml index 88007a8..424f9ff 100644 --- a/.github/workflows/azure-static-web-apps-gray-ocean-0501b9d0f.yml +++ b/.github/workflows/azure-static-web-apps-gray-ocean-0501b9d0f.yml @@ -14,6 +14,10 @@ jobs: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest name: Build and Deploy Job + env: + GA: ${{ vars.GA_ID_TEST }} + ROOT_URL: ${{ vars.ROOT_URL_TEST }} + SEARCH_SERVICE: ${{ vars.SEARCH_SERVICE_URL_TEST }} steps: - uses: actions/checkout@v3 with: