diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml new file mode 100644 index 000000000..b64231e6e --- /dev/null +++ b/.github/workflows/build-app.yml @@ -0,0 +1,58 @@ +# This is a basic workflow to help you get started with Actions + +name: App Main CI + +permissions: + contents: read + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master, vnext ] + paths: + - '**' + - '!projects/**' + pull_request: + branches: [ master, vnext ] + paths: + - '**' + - '!projects/**' +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x, 22.x] + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Npm add registry + run: npm config set @infragistics:registry https://${{secrets.IG_SCOPE}} + + - name: Npm config auth + run: npm config set ${{secrets.IG_SCOPE}}:_auth=${{secrets.IG_TOKEN}} + + - name: Install dependencies + run: npm install + + - name: Run lint + run: npm run lint + + - name: 'Generate live editing and build samples' + run: npm run build + env: + NODE_OPTIONS: "--max_old_space_size=4096" diff --git a/.github/workflows/cd-matrix.yml b/.github/workflows/cd-matrix.yml index 53b6acafc..c1ae242db 100644 --- a/.github/workflows/cd-matrix.yml +++ b/.github/workflows/cd-matrix.yml @@ -8,7 +8,6 @@ on: - master - vnext workflow_dispatch: - workflow_dispatch: inputs: branch: description: 'Input a branch name (e.g., vnext)' @@ -27,7 +26,7 @@ jobs: - name: app custom_command: run generate-live-editing submodule_dir: angular-demos - base_href: /angular-demos/ + base_href: angular-demos target_folder: dist/app npm_build_command: run build-ci repositoryfy: true @@ -35,7 +34,7 @@ jobs: - name: app-crm custom_command: run generate-live-editing:app-crm submodule_dir: angular-demos-crm - base_href: /angular-demos-grid-crm/ + base_href: angular-demos-grid-crm target_folder: dist/app-crm npm_build_command: run build-ci:app-crm --loglevel verbose repositoryfy: false @@ -43,7 +42,7 @@ jobs: - name: app-lob custom_command: run generate-live-editing:app-lob submodule_dir: angular-demos-lob - base_href: /angular-demos-lob/ + base_href: angular-demos-lob target_folder: dist/app-lob npm_build_command: run build-ci:app-lob repositoryfy: true @@ -54,6 +53,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ env.BRANCH_REF }} token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Node.js @@ -76,36 +76,41 @@ jobs: } - name: Create .npmrc file - run: touch .npmrc + run: | + if [ -f ".npmrc" ]; then + rm .npmrc + fi + touch .npmrc + - name: Configure npm registry run: | echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc - echo "//packages.infragistics.com/npm/js-licensed/:_authToken=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc + echo "//packages.infragistics.com/npm/js-licensed/:username=${{ secrets.INFRAGISTICS_NPM_USER }}" >> .npmrc + echo "//packages.infragistics.com/npm/js-licensed/:_auth=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc + # echo "//packages.infragistics.com/npm/js-licensed/:_authToken=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc - name: Install dependencies - run: npm install --legacy-peer-deps - env: - GITHUB_ACTIONS: true + run: npm install - name: Clone submodule run: git clone --recurse-submodules https://github.com/IgniteUI/igniteui-live-editing-samples igniteui-live-editing-samples - name: Checkout branch in submodule (vNext) - if: env.BRANCH_REF == 'refs/heads/vnext' + if: ${{ env.BRANCH_REF == 'refs/heads/vnext' }} run: | cd igniteui-live-editing-samples git checkout vNext - name: Checkout branch in submodule (master) - if: env.BRANCH_REF == 'refs/heads/master' + if: ${{ env.BRANCH_REF == 'refs/heads/master' }} run: | cd igniteui-live-editing-samples git checkout master - name: Update package.json with base href run: | - sed -i 's/--configuration production/--base-href=${{ matrix.base_href }} --configuration production/g' package.json + sed -i 's|--configuration production|--base-href=${{ matrix.base_href }} --configuration production|g' package.json - name: Generate live-editing run: npm ${{ matrix.custom_command }} @@ -115,9 +120,7 @@ jobs: npx --userconfig=./.npmrc ng g @igniteui/angular-schematics:upgrade-packages --skip-install - name: Install dependencies after schematics - run: npm install --legacy-peer-deps - env: - GITHUB_ACTIONS: true + run: npm install - name: Build application run: npm ${{ matrix.npm_build_command }} --userconfig=./.npmrc @@ -144,35 +147,32 @@ jobs: - name: Create zip artifact run: | cd ${{ matrix.target_folder }}/browser - zip -r ../../${{ matrix.submodule_dir }}-artifact.zip ./ + zip -r ${{ github.workspace }}/${{ matrix.base_href }}-artifact.zip ./ - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: ${{ matrix.submodule_dir }}-artifact - path: ${{ matrix.submodule_dir }}-artifact.zip + name: ${{ matrix.base_href }}-artifact + path: ${{ matrix.base_href }}-artifact.zip + retention-days: 1 - name: Repositorify (vNext) - if: env.BRANCH_REF == 'refs/heads/vnext' && matrix.repositoryfy == true + if: ${{ env.BRANCH_REF == 'refs/heads/vnext' && matrix.repositoryfy == true }} run: npm run ${{ matrix.repositoryfy_command }} - name: Repositorify (Production) - if: env.BRANCH_REF == 'refs/heads/master' && matrix.repositoryfy == true + if: ${{ env.BRANCH_REF == 'refs/heads/master' && matrix.repositoryfy == true }} run: npm run ${{ matrix.repositoryfy_command }}:prod - - name: Stage changes - if: matrix.repositoryfy == true - run: | - cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} - git add . - - name: Check for changes if: matrix.repositoryfy == true id: check_changes run: | cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} - if [ -n "$(git status --porcelain)" ]; then + if [ -n "$(git status --porcelain .)" ]; then echo "changes_detected=true" >> $GITHUB_OUTPUT + echo "Changed files:" + git status --porcelain . else echo "changes_detected=false" >> $GITHUB_OUTPUT echo "No changes to commit." @@ -184,32 +184,35 @@ jobs: cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . git commit -m "Automated repository update" + continue-on-error: true - name: Push changes if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true' run: | cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} - git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/IgniteUI/igniteui-live-editing-samples.git + git push https://x-access-token:${{ secrets.CLASSIC_PAT_GITHUB }}@github.com/IgniteUI/igniteui-live-editing-samples.git continue-on-error: true - name: Trigger Deploy Workflow in IgniteUI Actions uses: actions/github-script@v8 with: - github-token: ${{ secrets.CLASSIC_PATKA }} + github-token: ${{ secrets.CLASSIC_PAT_GITHUB }} script: | await github.rest.repos.createDispatchEvent({ owner: 'IgniteUI', repo: 'igniteui-actions', event_type: 'igniteui-angular-samples-cd', client_payload: { + calling_branch: "${{ env.BRANCH_REF }}", repository: "${{ github.repository }}", run_id: "${{ github.run_id }}", artifact_name: "${{ matrix.submodule_dir }}-artifact", + base_href: "${{ matrix.base_href }}", + submodule_dir: "${{ matrix.submodule_dir }}", ref: "${{ github.ref }}", sha: "${{ github.sha }}", branch: '${{ github.ref_name }}', - unit: false, - integration: true } }); diff --git a/.github/workflows/deploy-trigger.yml b/.github/workflows/deploy-trigger.yml deleted file mode 100644 index 329a838a3..000000000 --- a/.github/workflows/deploy-trigger.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Trigger Deployment Workflow - -on: - push: - branches: - - vnext - - master - workflow_dispatch: - inputs: - branch: - description: 'Input a branch name (e.g., vnext)' - required: true - -permissions: - contents: read -jobs: - trigger: - runs-on: ubuntu-latest - - steps: - - name: Debug Token Availability - run: | - if [ -z "${{ secrets.CLASSIC_PATKA }}" ]; then - echo "CLASSIC_PATKA secret is not set or is empty" - echo "Will fallback to github.token" - else - echo "CLASSIC_PATKA secret is available" - fi - - - name: Setup Node for Github CLI - uses: actions/setup-node@v4 - with: - node-version: '24.x' - - - name: Create Dummy Artifact - run: | - # Create a directory for the artifact - mkdir -p artifact-output - - # Create some dummy files with deployment information - echo "Deployment triggered successfully" > artifact-output/deployment-status.txt - echo "Branch: ${{ github.ref_name }}" >> artifact-output/deployment-status.txt - echo "Commit: ${{ github.sha }}" >> artifact-output/deployment-status.txt - echo "Timestamp: $(date)" >> artifact-output/deployment-status.txt - echo "Repository: ${{ github.repository }}" >> artifact-output/deployment-status.txt - - # Create a JSON file with deployment metadata - cat > artifact-output/deployment-metadata.json << EOF - { - "branch": "${{ github.ref_name }}", - "commit": "${{ github.sha }}", - "repository": "${{ github.repository }}", - "trigger_event": "${{ github.event_name }}", - "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", - "deployment_triggered": true - } - EOF - - # List the created files - ls -la artifact-output/ - - - name: Upload Deployment Artifact - uses: actions/upload-artifact@v4 - with: - name: deployment-trigger-info - path: artifact-output/ - retention-days: 30 - - - name: Trigger Workflow in Another Repository - uses: actions/github-script@v8 - with: - github-token: ${{ secrets.CLASSIC_PATKA || github.token }} - script: | - await github.rest.repos.createDispatchEvent({ - owner: 'IgniteUI', - repo: 'igniteui-actions', - event_type: 'igniteui-angular-samples-cd', - client_payload: { - repository: "${{ github.repository }}", - run_id: "${{ github.run_id }}", - artifact_name: "deployment-trigger-info", - ref: "${{ github.ref }}", - sha: "${{ github.sha }}", - branch: '${{ github.ref_name }}', - unit: false, - integration: true - } - }); diff --git a/azure-devops/app-cd.yml b/azure-devops/app-cd.yml index 5d47a6aa8..b9fd53156 100644 --- a/azure-devops/app-cd.yml +++ b/azure-devops/app-cd.yml @@ -1,8 +1,4 @@ -trigger: - branches: - include: - - master - - vnext +trigger: none # This pipeline is meant to build specific branches for deployment. It's not meant to be a part of PR validation. Ensure that this pipeline is reserved for deployment purposes. pr: none diff --git a/azure-devops/app-crm-cd.yml b/azure-devops/app-crm-cd.yml index 6719d3c19..325c608fc 100644 --- a/azure-devops/app-crm-cd.yml +++ b/azure-devops/app-crm-cd.yml @@ -1,8 +1,4 @@ -trigger: - branches: - include: - - master - - vnext +trigger: none # This pipeline is meant to build specific branches for deployment. It's not meant to be a part of PR validation. Ensure that this pipeline is reserved for deployment purposes. pr: none diff --git a/azure-devops/app-lob-cd.yml b/azure-devops/app-lob-cd.yml index 3dddb7563..653c9ebd7 100644 --- a/azure-devops/app-lob-cd.yml +++ b/azure-devops/app-lob-cd.yml @@ -1,8 +1,4 @@ -trigger: - branches: - include: - - master - - vnext +trigger: none # This pipeline is meant to build specific branches for deployment. It's not meant to be a part of PR validation. Ensure that this pipeline is reserved for deployment purposes. pr: none diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e06063a72..8bf07be72 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,3 +1,5 @@ +trigger: none + pool: vmImage: 'ubuntu-latest'