Skip to content

Updates CI/CD commands to use heft for newer versions of SPFx. Closes #7091 - #7379

Open
Adam-it wants to merge 2 commits into
pnp:mainfrom
Adam-it:ci-cd-commands-with-heft
Open

Updates CI/CD commands to use heft for newer versions of SPFx. Closes #7091#7379
Adam-it wants to merge 2 commits into
pnp:mainfrom
Adam-it:ci-cd-commands-with-heft

Conversation

@Adam-it

@Adam-it Adam-it commented May 31, 2026

Copy link
Copy Markdown
Member

Closes #7091

Result for SPFx 1.22+ project

GitHub

name: Deploy Solution spfx-test
on:
  push:
    branches:
      - main
  workflow_dispatch: null
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    env:
      NodeVersion: 22.x
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Use Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.NodeVersion }}
      - name: Run npm ci
        run: npm ci
      - name: Build & Package
        run: |
          npm install -g @rushstack/heft@latest
          heft build --production
          heft package-solution --production
      - name: CLI for Microsoft 365 Login
        uses: pnp/action-cli-login@v4
        with:
          CERTIFICATE_ENCODED: ${{ secrets.CERTIFICATE_ENCODED }}
          CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
          APP_ID: ${{ secrets.APP_ID }}
          TENANT: ${{ secrets.TENANT_ID }}
      - name: CLI for Microsoft 365 Deploy App
        uses: pnp/action-cli-deploy@v6
        with:
          APP_FILE_PATH: sharepoint/solution/spfx-test.sppkg
          SKIP_FEATURE_DEPLOYMENT: false
          OVERWRITE: true
          SCOPE: sitecollection
          SITE_COLLECTION_URL: https://tenanttocheck.sharepoint.com/sites/gamedemo3

Azure DevOps

name: Deploy Solution new-spfx-deploy-demo
trigger:
  branches:
    include:
      - main
pool:
  vmImage: ubuntu-latest
variables:
  - name: CertificateBase64Encoded
    value: ""
  - name: CertificatePassword
    value: ""
  - name: EntraAppId
    value: ""
  - name: TenantId
    value: ""
  - name: SharePointBaseUrl
    value: "https://tenanttocheck.sharepoint.com"
  - name: PackageName
    value: new-spfx-deploy-demo.sppkg
  - name: SppkgPath
    value: solution/new-spfx-deploy-demo.sppkg
  - name: SiteAppCatalogUrl
    value: https://tenanttocheck.sharepoint.com/sites/gamedemo3
  - name: NodeVersion
    value: 22.x
stages:
  - stage: Build_and_Deploy
    jobs:
      - job: Build_and_Deploy
        steps:
          - task: NodeTool@0
            displayName: Use Node.js
            inputs:
              versionSpec: $(NodeVersion)
          - task: Npm@1
            displayName: Run npm install
            inputs:
              command: install
          - task: CmdLine@2
            displayName: Heft build and package
            inputs:
              script: |
                npm install -g @rushstack/heft@latest
                heft build --production
                heft package-solution --production
          - task: Npm@1
            displayName: Install CLI for Microsoft 365
            inputs:
              command: custom
              verbose: false
              customCommand: install -g @pnp/cli-microsoft365
          - script: >
              
              m365 login --authType certificate --certificateBase64Encoded
              '$(CertificateBase64Encoded)' --password '$(CertificatePassword)'
              --appId '$(EntraAppId)' --tenant '$(TenantId)' 

              m365 spo set --url '$(SharePointBaseUrl)' 

              m365 spo app add --filePath
              '$(Build.SourcesDirectory)/sharepoint/$(SppkgPath)'
              --appCatalogScope sitecollection --appCatalogUrl
              '$(SiteAppCatalogUrl)' --overwrite 

              m365 spo app deploy --name '$(PackageName)' --appCatalogScope
              sitecollection --appCatalogUrl '$(SiteAppCatalogUrl)'
            displayName: CLI for Microsoft 365 Deploy App

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates SPFx deployment generators to use Heft for SPFx 1.22+ projects.

Changes:

  • Replaces Gulp build/package steps with Heft commands when required.
  • Extends Azure pipeline modeling and adds generator tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
project-github-workflow-add.ts Generates Heft-based GitHub workflows.
project-github-workflow-add.spec.ts Tests Heft workflow generation.
project-azuredevops-pipeline-model.ts Supports command-line task scripts.
project-azuredevops-pipeline-add.ts Generates Heft-based Azure pipelines.
project-azuredevops-pipeline-add.spec.ts Tests Heft pipeline generation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/m365/spfx/commands/project/project-github-workflow-add.ts Outdated
Comment thread src/m365/spfx/commands/project/project-azuredevops-pipeline-add.ts Outdated

@milanholemans milanholemans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review @Adam-it
I made a few comments while reviewing, could you have a look, please?

Comment thread src/m365/spfx/commands/project/project-github-workflow-add.ts Outdated
Comment thread src/m365/spfx/commands/project/project-github-workflow-add.ts Outdated
Comment thread src/m365/spfx/commands/project/project-github-workflow-add.spec.ts Outdated
Comment thread src/m365/spfx/commands/project/project-github-workflow-add.spec.ts Outdated
Comment thread src/m365/spfx/commands/project/project-azuredevops-pipeline-add.ts Outdated
Comment thread src/m365/spfx/commands/project/project-azuredevops-pipeline-add.ts Outdated
Comment thread src/m365/spfx/commands/project/project-azuredevops-pipeline-add.spec.ts Outdated
@milanholemans
milanholemans marked this pull request as draft August 18, 2026 22:57
@Adam-it
Adam-it marked this pull request as ready for review August 30, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The spfx ci/cd commands generate wokrflow/pipeline that use gulp for SPFx 1.22.x projects

3 participants