Skip to content

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

Open
Adam-it wants to merge 1 commit 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 1 commit into
pnp:mainfrom
Adam-it:ci-cd-commands-with-heft

Conversation

@Adam-it
Copy link
Copy Markdown
Member

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

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

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

1 participant