Skip to content

Commit 28fc2db

Browse files
committed
Renames action to 'CLI for Microsoft 365 Deploy'
1 parent c8e58c2 commit 28fc2db

File tree

8 files changed

+65
-49
lines changed

8 files changed

+65
-49
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Office 365 CLI deploy GitHub action
2-
GitHub action to deploy an app using Office 365 CLI
1+
# CLI for Microsoft 365 Deploy
2+
GitHub action to deploy an app using CLI for Microsoft 365
33

4-
![Office 365 CLI Deploy App](./images/cli-deploy.png)
4+
![CLI for Microsoft 365 Deploy App](./images/pnp-cli-microsoft365-blue.svg)
55

6-
This GitHub Action (created using typescript) uses [Office 365 CLI](https://pnp.github.io/office365-cli/), specifically the [spo app add](https://pnp.github.io/office365-cli/cmd/spo/app/app-add/), [spo app deploy](https://pnp.github.io/office365-cli/cmd/spo/app/app-deploy/) commands, to add and deploy.
6+
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.
77

88
## Usage
99
### Pre-requisites
10-
Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#example-workflow---office-365-cli-deploy) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
10+
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://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
1111

1212
## Dependencies on other GitHub Actions
1313

14-
- [Office 365 CLI 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.
14+
- [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.
1515

1616
#### Optional requirement
1717
Since `action-cli-login` requires user name and password which are 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). So, click on `settings` tab in your repo and add 2 new secrets:
@@ -29,11 +29,11 @@ These secrets are encrypted and can only be used by GitHub actions.
2929
### Output
3030
- `APP_ID` : The id of the app that gets deployed
3131

32-
### Example workflow - Office 365 CLI Deploy
32+
### Example workflow - CLI for Microsoft 365 Deploy
3333
On every `push` build the code, then login to Office 365 and then start deploying.
3434

3535
```yaml
36-
name: SPFx CICD with O365 CLI
36+
name: SPFx CICD with CLI for Microsoft 365
3737

3838
on: [push]
3939

@@ -56,38 +56,38 @@ jobs:
5656
## Code to get the package omitted
5757
##
5858

59-
# Office 365 cli login action
59+
# CLI for Microsoft 365 login action
6060
- name: Login to tenant
61-
uses: pnp/action-cli-login@v1.0.0
61+
uses: pnp/action-cli-login@v2.0.0
6262
with:
6363
ADMIN_USERNAME: ${{ secrets.adminUsername }}
6464
ADMIN_PASSWORD: ${{ secrets.adminPassword }}
6565

66-
# Office 365 cli deploy app action
66+
# CLI for Microsoft 365 deploy app action
6767
# Use either option 1 or option 2
6868

6969
# Option 1 - Deploy app at tenant level
7070
- name: Option 1 - Deploy app to tenant
7171
id: o365clideploy # optional - use if output needs to be used
72-
uses: pnp/action-cli-deploy@v1.0.1
72+
uses: pnp/action-cli-deploy@v2.0.0
7373
with:
74-
APP_FILE_PATH: sharepoint/solution/spfx-o365-cli-action.sppkg
74+
APP_FILE_PATH: sharepoint/solution/spfx-cli-microsoft365-action.sppkg
7575
SKIP_FEATURE_DEPLOYMENT: true
7676
OVERWRITE: true
7777
# Option 1 - ends
7878

7979
# Option 2 - Deploy app to a site collection
8080
- name: Option 2 - Deploy app to a site collection
81-
uses: pnp/action-cli-deploy@v1.0.1
81+
uses: pnp/action-cli-deploy@v2.0.0
8282
with:
83-
APP_FILE_PATH: sharepoint/solution/spfx-o365-cli-action.sppkg
83+
APP_FILE_PATH: sharepoint/solution/spfx-cli-microsoft365-action.sppkg
8484
SCOPE: sitecollection
8585
SITE_COLLECTION_URL: https://contoso.sharepoint.com/sites/teamsite
8686
# Option 2 - ends
8787

8888
# Print the id of the app
8989
- name: Get the id of the app deployed
90-
run: echo "The id of the app deployed is ${{ steps.o365clideploy.outputs.APP_ID }}"
90+
run: echo "The id of the app deployed is ${{ steps.climicrosoft365deploy.outputs.APP_ID }}"
9191
```
9292
9393
@@ -96,8 +96,13 @@ If self-hosted runners are used for running the workflow, then please make sure
9696

9797
## Release notes
9898

99-
### v1.0.0
100-
- Added inital 'Office 365 CLI deploy' GitHub action solving #2
99+
### v2.0.0
100+
101+
- Renames action to 'CLI for Microsoft 365'
101102

102103
### v1.0.1
103-
- Fixed 'skipFeatureDeployment not included in spo app deploy command for Windows' solving #4
104+
- Fixed 'skipFeatureDeployment not included in spo app deploy command for Windows' solving #4
105+
106+
### v1.0.0
107+
- Added inital 'CLI for Microsoft 365 deploy' GitHub action solving #2
108+

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Office 365 CLI Deploy App'
2-
description: 'Deploy an app using Office 365 CLI'
1+
name: 'CLI for Microsoft 365 Deploy App'
2+
description: 'Deploy an app using CLI for Microsoft 365'
33
inputs:
44
APP_FILE_PATH:
55
description: 'Relative path of the app in your repo'

dist/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -974,11 +974,11 @@ const core = __importStar(__webpack_require__(470));
974974
const exec_1 = __webpack_require__(986);
975975
const io_1 = __webpack_require__(1);
976976
const fs_1 = __webpack_require__(747);
977-
let o365CLIPath;
977+
let cliMicrosoft365Path;
978978
function main() {
979979
return __awaiter(this, void 0, void 0, function* () {
980980
try {
981-
o365CLIPath = yield io_1.which("o365", true);
981+
cliMicrosoft365Path = yield io_1.which("m365", true);
982982
const appFilePath = core.getInput("APP_FILE_PATH", { required: true });
983983
const scope = core.getInput("SCOPE", { required: false });
984984
const siteCollectionUrl = core.getInput("SITE_COLLECTION_URL", { required: false });
@@ -993,13 +993,13 @@ function main() {
993993
core.setFailed("SITE_COLLECTION_URL not specified");
994994
}
995995
else {
996-
appId = yield executeO365CLICommand(`spo app add -p ${appFilePath} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${overwrite}`, true);
997-
yield executeO365CLICommand(`spo app deploy --id ${appId} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${skipFeatureDeployment}`);
996+
appId = yield executeCLIMicrosoft365Command(`spo app add -p ${appFilePath} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${overwrite}`, true);
997+
yield executeCLIMicrosoft365Command(`spo app deploy --id ${appId} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${skipFeatureDeployment}`);
998998
}
999999
}
10001000
else {
1001-
appId = yield executeO365CLICommand(`spo app add -p ${appFilePath} ${overwrite}`, true);
1002-
yield executeO365CLICommand(`spo app deploy --id ${appId} ${skipFeatureDeployment}`);
1001+
appId = yield executeCLIMicrosoft365Command(`spo app add -p ${appFilePath} ${overwrite}`, true);
1002+
yield executeCLIMicrosoft365Command(`spo app deploy --id ${appId} ${skipFeatureDeployment}`);
10031003
}
10041004
core.info("✅ Upload and deployment complete.");
10051005
core.setOutput("APP_ID", appId);
@@ -1015,18 +1015,18 @@ function main() {
10151015
}
10161016
});
10171017
}
1018-
function executeO365CLICommand(command, cleanOutput) {
1018+
function executeCLIMicrosoft365Command(command, cleanOutput) {
10191019
return __awaiter(this, void 0, void 0, function* () {
1020-
let o365CLICommandOutput = '';
1020+
let cliMicrosoft365CommandOutput = '';
10211021
const options = {};
10221022
options.listeners = {
10231023
stdout: (data) => {
1024-
o365CLICommandOutput += data.toString();
1024+
cliMicrosoft365CommandOutput += data.toString();
10251025
}
10261026
};
10271027
try {
1028-
yield exec_1.exec(`"${o365CLIPath}" ${command}`, [], options);
1029-
return cleanOutput ? o365CLICommandOutput.trim() : o365CLICommandOutput;
1028+
yield exec_1.exec(`"${cliMicrosoft365Path}" ${command}`, [], options);
1029+
return cleanOutput ? cliMicrosoft365CommandOutput.trim() : cliMicrosoft365CommandOutput;
10301030
}
10311031
catch (err) {
10321032
throw new Error(err);

images/cli-deploy.png

-63.9 KB
Binary file not shown.

images/pnp-cli-microsoft365-blue.svg

Lines changed: 1 addition & 0 deletions
Loading

package.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"name": "@pnp/action-cli-deploy",
3-
"version": "1.0.1",
4-
"description": "GitHub Action to deploy an app using Office 365 CLI",
3+
"version": "2.0.0",
4+
"description": "GitHub Action to deploy an app using CLI for Microsoft 365",
55
"main": "dist/index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1",
8-
"build": "ncc build src\\main.ts"
7+
"build": "ncc build src/main.ts"
98
},
109
"author": "Tatti, Anoop <[email protected]>",
1110
"maintainers": [
@@ -23,6 +22,16 @@
2322
"name": "Garry Trinder",
2423
"email": "[email protected]",
2524
"web": "https://garrytrinder.github.io/"
25+
},
26+
{
27+
"name": "Albert-Jan Schot",
28+
"email": "[email protected]",
29+
"web": "https://www.cloudappie.nl/"
30+
},
31+
{
32+
"name": "Rabia Williams",
33+
"email": "[email protected]",
34+
"web": "https://rabiawilliams.com/"
2635
}
2736
],
2837
"contributors": [
@@ -41,10 +50,11 @@
4150
"url": "https://github.com/pnp/action-cli-deploy/issues"
4251
},
4352
"keywords": [
44-
"GitHub action",
4553
"office 365",
54+
"microsoft 365",
4655
"sharepoint framework",
4756
"o365",
57+
"m365",
4858
"spfx",
4959
"sharepoint online",
5060
"sharepoint",
@@ -67,4 +77,4 @@
6777
"typescript": "^3.7.4",
6878
"@types/node": "^13.1.6"
6979
}
70-
}
80+
}

src/main.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { exec } from '@actions/exec';
33
import { which } from '@actions/io';
44
import { existsSync } from 'fs';
55

6-
let o365CLIPath: string;
6+
let cliMicrosoft365Path: string;
77

88
async function main() {
99
try {
10-
o365CLIPath = await which("o365", true);
10+
cliMicrosoft365Path = await which("m365", true);
1111

1212
const appFilePath: string = core.getInput("APP_FILE_PATH", { required: true });
1313
const scope: string = core.getInput("SCOPE", { required: false });
@@ -24,12 +24,12 @@ async function main() {
2424
core.error("🚨 Site collection URL - SITE_COLLECTION_URL - is needed when scope is set to sitecollection.");
2525
core.setFailed("SITE_COLLECTION_URL not specified");
2626
} else {
27-
appId = await executeO365CLICommand(`spo app add -p ${appFilePath} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${overwrite}`, true);
28-
await executeO365CLICommand(`spo app deploy --id ${appId} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${skipFeatureDeployment}`);
27+
appId = await executeCLIMicrosoft365Command(`spo app add -p ${appFilePath} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${overwrite}`, true);
28+
await executeCLIMicrosoft365Command(`spo app deploy --id ${appId} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${skipFeatureDeployment}`);
2929
}
3030
} else {
31-
appId = await executeO365CLICommand(`spo app add -p ${appFilePath} ${overwrite}`, true);
32-
await executeO365CLICommand(`spo app deploy --id ${appId} ${skipFeatureDeployment}`);
31+
appId = await executeCLIMicrosoft365Command(`spo app add -p ${appFilePath} ${overwrite}`, true);
32+
await executeCLIMicrosoft365Command(`spo app deploy --id ${appId} ${skipFeatureDeployment}`);
3333
}
3434
core.info("✅ Upload and deployment complete.");
3535
core.setOutput("APP_ID", appId);
@@ -43,17 +43,17 @@ async function main() {
4343
}
4444
}
4545

46-
async function executeO365CLICommand(command: string, cleanOutput?: boolean): Promise<any> {
47-
let o365CLICommandOutput = '';
46+
async function executeCLIMicrosoft365Command(command: string, cleanOutput?: boolean): Promise<any> {
47+
let cliMicrosoft365CommandOutput = '';
4848
const options: any = {};
4949
options.listeners = {
5050
stdout: (data: Buffer) => {
51-
o365CLICommandOutput += data.toString();
51+
cliMicrosoft365CommandOutput += data.toString();
5252
}
5353
};
5454
try {
55-
await exec(`"${o365CLIPath}" ${command}`, [], options);
56-
return cleanOutput ? o365CLICommandOutput.trim() : o365CLICommandOutput;
55+
await exec(`"${cliMicrosoft365Path}" ${command}`, [], options);
56+
return cleanOutput ? cliMicrosoft365CommandOutput.trim() : cliMicrosoft365CommandOutput;
5757
}
5858
catch (err) {
5959
throw new Error(err);

0 commit comments

Comments
 (0)