CI-CD_DOCUMENTATION.md
Go to https://sonarcloud.io/
Click the "Log in" button and create a new account or connect with GitHub account (recommended)
At the top right corner click the "+" sign
From the dropdown select "Create new Organization"
Click the "Choose an organization on GitHub" button
Select an account for the organization setup
On Repository Access select "Only select repositories" and select the project and click the "Save" button
On the "Create organization page" don't change the Key and click "Continue"
Select the Free plan then click the "Create Organization" button to finalize the creation of the Organization
At the top right corner click the "+" sign and select "Analyze new project"
Select the project and click the "Set Up" button in the box on the right
Under "Choose your analysis method" click "With GitHub Actions" and keep the following page open
Create a new PAT with repo_deployment and read:packages permissions and copy the value of the generated token
In the project's GitHub repository, go to the Settings tab -> Secrets
Click on New Repository secret and create a new secret with the name SONAR_GITHUB_TOKEN and the token you just copied as the value
Create another secret with the two values from the SonarCloud page you kept open, which you can close after completing this step
After the "Notepads CI/CD Pipeline" workflow has executed successfully, go to https://sonarcloud.io/projects and click on the project
In the alert bar above the results, click the "Set new code definition" button and select "Previous version" (notice the "New Code definition has been updated" alert at the top)
The Quality Gate will become active as soon as the next SonarCloud scan completes successfully
<a name="workflow_dispatch"></a>
Once you've set up all the steps above correctly, you should be able to successfully complete a manual execution of the "Notepads CI/CD Pipeline" workflow.
Go to the project's GitHub repository and click on the Actions tab
From the "Workflows" list on the left, click on "Notepads CI/CD Pipeline"
On the right, next to the "This workflow has a workflow_dispatch event trigger" label, click on the "Run workflow" dropdown, make sure the default branch is selected (if not manually changed, should be main or master) in the "Use workflow from" dropdown and click the "Run workflow" button
You can optionally fill the argument textbox with "release" to trigger GitHub Release and Store Upload
NOTE: screenshots are only exemplary
Dependabot is a GitHub native security tool that goes through the dependencies in the project and creates alerts, and PRs with updates when a new and/or non-vulnerable version is found.
Go to "Settings" tab of the repo
Go to "Security & analysis" section
Click "Enable" for both "Dependabot alerts" and "Dependabot security updates"
Go to "Settings" tab of the repo
Go to "Security&Analysis" section
Click "Enable" for the "Dependency graph" option
NOTE: screenshots are only exemplary
CodeQL is GitHub's own industry-leading semantic code analysis engine. CodeQL requires no setup, because it comes fully pre-configured by us.
To activate it and see its results, only a push commit or a merge of a PR to the default branch of the repository, is required.
We've also configured CodeQL to run on schedule, so every day at 8:00AM UTC, it automatically scans the code.
NOTE: This tool executes automatically when Notepads CI/CD Pipeline action completes.
This tool is automatically triggered when Notepads CI/CD Pipeline task completes, if you want to manually execute this follow next steps
In your repo, click on the Actions tab and on the left, in the Workflows list, click on the "Code scanning alerts bulk dismissal"
<a name="csa_execute"></a>
NOTE: if any unsupported values are entered default values will be used
NOTE: "closed" refers to "dismissed" alerts
The "setup" job in the pipeline, allows for more precise filtering of alerts to bulk dismiss. It uses the filter type to choose (filter based on path or description) from the alert to determine if it has to be dismissed or not. We've added the following paths and alert descriptions by default:
obj folder at any position)In your source code, open ".github/workflows/csa-bulk-dismissal.yml"
From line 50 to 56, notice "$MATRIX = **". This is the powershell hashtable of filters that the CSABD (Code scanning alerts bulk dismissal) tool uses to filter through the alerts:
@{ filter = "New path" }. Replace "New path" with the path (with or without wild cards) you want:In your source code, open ".github/workflows/csa-bulk-dismissal.yml"
From line 58 to 67, notice "$MATRIX = **". This is the powershell hashtable of filters that the CSABD (Code scanning alerts bulk dismissal) tool uses to filter through the alerts:
@{ filter = "New description" }. Replace "New description" with the description you want:In your source code, open ".github/workflows/csa-bulk-dismissal.yml"
To change default filter type change $FILTER_TYPE variable in line 31 to something else (default is "path", supported are: "desc" and "path"):
NOTE: changing default filter type and dismissal reason won't change dafault value typed when manually executing tool, change values in line 13 and 17 respectively to reflect the change
<a name="github_release"></a>
When triggered bumps up the GitHub tag in the repo and executes the CD job and produces release with changelogs
Note: not every commit to your master branch are included in changelog
Add the following secrets by going to the repo Settings tab -> Secrets:
# read from PFX as binary
$PFX_FILE = [IO.File]::ReadAllBytes('absolute_path_to_PFX')
# convert to Base64 and write in txt
[System.Convert]::ToBase64String($PFX_FILE) | Out-File 'absolute_path\cert.txt'
NOTE:
Once you've set up all the steps for manual execution of the "Notepads CI/CD Pipeline" workflow correctly, you should be able to successfully trigger release with the same workflow.
Go to the project's GitHub repository and click on the Actions tab
From the "Workflows" list on the left, click on "Notepads CI/CD Pipeline"
On the right, next to the "This workflow has a workflow_dispatch event trigger" label, click on the "Run workflow" dropdown, make sure the default branch is selected (if not manually changed, should be main or master) in the "Use workflow from" dropdown, type "release" in the argument textbox (By default "test" is typed) and click the "Run workflow" button
NOTE: screenshots are only exemplary
You would need one of three keywords at the start of your commit title. Each of the three keywords corresponds to a number in your release version i.e. v1.2.3. The release versioning uses the "Conventional Commits" specification:
Note: when making a MAJOR release by committing through a terminal, use the multiple line syntax to add the commit title on one line and then adding an empty line, and then adding the "BREAKING CHANGE: " label
Example(fix/PATCH):
git commit -a -m "fix: this is a PATCH release triggering commit"
git push origin master
On triggering Release:
Result: v1.2.3 -> v1.2.4
Example(feat/MINOR):
git commit -a -m "feat: this is a MINOR release triggering commit"
git push origin master
On triggering Release:
Result: v1.2.3 -> v1.3.0
Example(perf/MAJOR):
git commit -a -m "perf: this is a MAJOR release triggering commit `
>>
>> BREAKING CHANGE: this is the breaking change"
git push origin master
On triggering Release:
Result: v1.2.3 -> v2.0.0
Note: in the MAJOR release example, the PowerShell multiline syntax ` (backtick) is used. After writing a backtick, a press of the Enter key should open a new line.
<a name="store_upload"></a>
Create an Azure AD tenant or use an existing one
Associate your Microsoft Partner Center with the Azure AD tenant
Create a new app registration or use an existing one from the list in your portal.azure.com -> Azure Active Directory -> App registrations section
Add the Azure AD application to the Microsoft Partner Center and give it "Manager" permissions
In the project's GitHub repo, create the following secrets:
AZURE_AD_TENANT_ID and AZURE_AD_APPLICATION_CLIENT_ID
Note: screenshot is taken from portal.azure.com -> Azure AD -> App registrations -> app-name page
AZURE_AD_APPLICATION_SECRET
STORE_APP_ID
master branch with a new Identity.Version in the Package.appxmanifest, a new submission in the Microsoft Partner Center with the new *.msixupload package should appear and be automatically submitted if all verifications passIn a new tab open GitHub, at the top right corner, click on your profile picture and click on Settings from the dropdown.
Go to Developer Settings -> Personal access tokens.
Click the Generate new token button and enter password if prompted.
Name the token, from the permissions list choose the ones needed and at the bottom click on the Generate token button.
Copy the token value and paste it wherever its needed
NOTE: once you close or refresh the page, you won't be able to copy the value of the PAT again!
Built with ❤ by Pipeline Foundation