Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [20]
node: [24]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -56,8 +56,8 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
nodeRun: [20]
nodeBuild: [20]
nodeRun: [24]
nodeBuild: [24]

steps:
- name: Configure pagefile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [24]

name: CLI Deploy Job

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [24]

name: CLI Deploy Job

Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# CLI for Microsoft 365 Deploy

GitHub action to deploy an app using CLI for Microsoft 365

![CLI for Microsoft 365 Deploy App](./images/pnp-cli-microsoft365-blue.svg)

This GitHub Action (created using typescript) uses [CLI for Microsoft 365](https://pnp.github.io/cli-microsoft365/), specifically the [spo app add](https://pnp.github.io/cli-microsoft365/cmd/spo/app/app-add/), [spo app deploy](https://pnp.github.io/cli-microsoft365/cmd/spo/app/app-deploy/) commands, to add and deploy.

## Usage

### Pre-requisites

Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#example-workflow---cli-for-microsoft-365-deploy) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://docs.github.com/en/actions/writing-workflows/quickstart).

## Dependencies on other GitHub Actions

- [CLI for Microsoft 365 Login](https://github.com/pnp/action-cli-login) – **Required** . This action is dependant on `action-cli-login`. So in the workflow we need to run `action-cli-login` before using this action.

#### Optional requirement
### Optional requirement

Since `action-cli-login` requires sensitive pieces of information, it would be ideal to store them securely. We can achieve this in a GitHub repo by using [secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). Consult the [action-cli-login](https://github.com/pnp/action-cli-login) docs to check which information you need.

### Compatibility matrix
Expand All @@ -27,16 +31,19 @@ v2.0.2 | v5.8.0
v1.0.0 | v2.5.0

### Inputs
- `APP_FILE_PATH` : **Required** Relative path of the app in your repo
- `SCOPE` : Scope of the app catalog: `tenant`, `sitecollection`. Default is `tenant`
- `SITE_COLLECTION_URL` : The URL of the site collection where the solution package will be added. Required if scope is set to `sitecollection`
- `SKIP_FEATURE_DEPLOYMENT` : `true` or `false`. If the app supports tenant-wide deployment, deploy it to the whole tenant. Default is `false`
- `OVERWRITE` : `true`, `false`. Set to overwrite the existing package file. Default is `false`

- `APP_FILE_PATH` : **Required** Relative path of the app in your repo.
- `SCOPE` : Scope of the app catalog: `tenant`, `sitecollection`. Default is `tenant`.
- `SITE_COLLECTION_URL` : The URL of the site collection where the solution package will be added. Required if scope is set to `sitecollection`.
- `SKIP_FEATURE_DEPLOYMENT` : `true` or `false`. If the app supports tenant-wide deployment, deploy it to the whole tenant. Default is `false`.
- `OVERWRITE` : `true`, `false`. Set to overwrite the existing package file. Default is `false`.

### Output

- `APP_ID` : The id of the app that gets deployed

### Example workflow - CLI for Microsoft 365 Deploy

On every `push` build the code, then log in to Office 365 and then start deploying.

```yaml
Expand All @@ -55,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
node-version: [24]

steps:

Expand All @@ -65,7 +72,7 @@ jobs:

# CLI for Microsoft 365 login action
- name: Log in to tenant
uses: pnp/action-cli-login@v3
uses: pnp/action-cli-login@v4
with:
TENANT: ${{ secrets.TENANT }}
APP_ID: ${{ secrets.APP_ID }}
Expand All @@ -76,7 +83,7 @@ jobs:
# Option 1 - Deploy app at tenant level
- name: Option 1 - Deploy app to tenant
id: climicrosoft365deploy # optional - use if output needs to be used
uses: pnp/action-cli-deploy@v5
uses: pnp/action-cli-deploy@v6
with:
APP_FILE_PATH: sharepoint/solution/spfx-cli-microsoft365-action.sppkg
SKIP_FEATURE_DEPLOYMENT: true
Expand All @@ -85,7 +92,7 @@ jobs:

# Option 2 - Deploy app to a site collection
- name: Option 2 - Deploy app to a site collection
uses: pnp/action-cli-deploy@v5
uses: pnp/action-cli-deploy@v6
with:
APP_FILE_PATH: sharepoint/solution/spfx-cli-microsoft365-action.sppkg
SCOPE: sitecollection
Expand All @@ -98,4 +105,5 @@ jobs:
```

#### Self-hosted runners
If self-hosted runners are used for running the workflow, then please make sure that they have `PowerShell` or `bash` installed on them.

If self-hosted runners are used for running the workflow, then please make sure that they have `PowerShell` or `bash` installed on them.
14 changes: 7 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ name: CLI for Microsoft 365 Deploy App
description: Deploy an app using CLI for Microsoft 365
inputs:
APP_FILE_PATH:
description: Relative path of the app in your repo
description: Relative path of the app in your repo.
required: true
SCOPE:
description: 'Scope of the app catalog: tenant or site collection. Default is tenant'
description: Scope of the app catalog: tenant or site collection. Default is tenant.
required: false
default: tenant
SITE_COLLECTION_URL:
description: The URL of the site collection where the solution package will be added. Required if scope is set to site collection
description: The URL of the site collection where the solution package will be added. Required if scope is set to site collection.
required: false
SKIP_FEATURE_DEPLOYMENT:
description: True or false. If the app supports tenant-wide deployment, deploy it to the whole tenant. Default is false
description: True or false. If the app supports tenant-wide deployment, deploy it to the whole tenant. Default is false.
required: false
default: 'false'
OVERWRITE:
description: True or false. Set to overwrite the existing package file. Default is false
description: True or false. Set to overwrite the existing package file. Default is false.
required: false
default: 'false'
outputs:
APP_ID:
description: The Id of the app that gets deployed
description: The Id of the app that gets deployed.
runs:
using: node20
using: node24
main: dist/index.js
branding:
icon: download
Expand Down
24 changes: 13 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pnp/action-cli-deploy",
"version": "5.0.1",
"version": "6.0.0",
"description": "GitHub Action to deploy an app using CLI for Microsoft 365",
"license": "MIT",
"main": "lib/main.js",
Expand Down Expand Up @@ -119,7 +119,7 @@
},
"devDependencies": {
"@types/mocha": "10.0.6",
"@types/node": "20.11.10",
"@types/node": "^24.10.4",
"@types/sinon": "10.0.16",
"@typescript-eslint/eslint-plugin": "6.20.0",
"@typescript-eslint/parser": "6.20.0",
Expand Down
Loading