Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Commit ec6ecaf

Browse files
authored
Initial commit
0 parents  commit ec6ecaf

20 files changed

+2045
-0
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# CODEOWNERS Generated [DATE]
3+
#
4+
5+
* @wcenterprises/digital-is-superusers [CODE-OWNERS]
6+
7+
*.yml @wcenterprises/digital-is-build
8+
/build/ @wcenterprises/digital-is-build
9+
/.github/ @wcenterprises/digital-is-build

.github/codeql/codeql-config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name: digital-is-jh-service-template CodeQL config

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "nuget" # See documentation for possible values
9+
directory: "/source" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
day: "sunday"
13+
open-pull-requests-limit: 0
14+
15+
# notify of updates to actions
16+
- package-ecosystem: "github-actions"
17+
directory: /
18+
labels:
19+
- dependabot
20+
- actions
21+
schedule:
22+
interval: "weekly"
23+
day: "sunday"
24+
open-pull-requests-limit: 0
25+

.github/package-updates.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: update-packages
2+
#UTC Time, Central is 6 hours behind UTC, 24 hour time format.
3+
on:
4+
schedule:
5+
- cron: "0 10,22 * * *"
6+
workflow_dispatch:
7+
inputs:
8+
logLevel:
9+
description: "Log level"
10+
required: true
11+
default: "warning"
12+
type: choice
13+
options:
14+
- info
15+
- warning
16+
- debug
17+
18+
jobs:
19+
update-packages:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
- name: Package Updates
26+
run: |
27+
dotnet nuget add source `
28+
--username "AutoUpdates" `
29+
--password "${{ secrets.AZDO_NUGET_REPO }}" `
30+
--store-password-in-clear-text `
31+
--name IS-Nuget "https://pkgs.dev.azure.com/JackHenry/_packaging/IS-Nuget/nuget/v3/index.json"
32+
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "AutoUpdates"
35+
36+
# only update the nuget packages that start with 'Jha.'
37+
Set-Variable -Name "PACKAGEIDSTARTSWITH" -Value "Jha." -Option Constant
38+
39+
# jira ticket
40+
Set-Variable -Name "DEFAULTJIRATICKET" -Value "BSL-2921" -Option Constant
41+
$JiraTicket = "${{ vars.PACKAGE_UPDATE_JIRA_TICKET }}"
42+
43+
if (-NOT $JiraTicket) {
44+
$JiraTicket = $DefaultJiraTicket
45+
}
46+
47+
# the name of the feature branch that is created.
48+
Set-Variable -Name "FEATUREBRANCH" -Value "update-bot/package-updates" -Option Constant
49+
50+
$branchExists = git ls-remote --heads origin $featureBranch
51+
52+
Write-Host "Branch Exists: " $branchExists
53+
54+
# creates new branch.
55+
function Add-NewBranch {
56+
if ($branchExists) {
57+
git checkout $featureBranch
58+
}
59+
else {
60+
git checkout -b $featureBranch
61+
}
62+
63+
if ($LASTEXITCODE -ne 0) {
64+
Write-Error "Failed to create a new branch."
65+
exit 1
66+
}
67+
}
68+
69+
# pushes the new branch.
70+
function Push-NewBranch {
71+
git add -A
72+
git commit -m "Updating Jha.* Packages."
73+
74+
if ($branchExists) {
75+
git push origin HEAD:$featureBranch
76+
}
77+
else {
78+
git push -u origin $featureBranch
79+
}
80+
81+
if ($LASTEXITCODE -ne 0) {
82+
Write-Error "Failed to push new branch."
83+
exit 1
84+
}
85+
}
86+
87+
# creates a pull request.
88+
function Add-PullRequest {
89+
90+
$prState = gh pr view --json state | ConvertFrom-Json
91+
92+
Write-Host "PR State " $prState.state
93+
94+
if ($null -eq $prState -or $prState.state -eq "CLOSED" -or $prState.state -eq "MERGED" ) {
95+
$body = "Description: Updating Jha.* Packages. `r`nJira-Tickets: $JiraTicket`r`n"
96+
gh pr create --title "Jha.* Packages Updates (Bump)" --body $body
97+
}
98+
99+
Write-Host "PR State " $prState.state
100+
101+
Write-Host "PR Data " $prState
102+
103+
if ($LASTEXITCODE -ne 0) {
104+
Write-Error "Failed to create a pull request."
105+
exit 1
106+
}
107+
}
108+
109+
# update with dotnet commands.
110+
function Update-WithDotNet {
111+
[CmdletBinding()]
112+
param(
113+
[Parameter(mandatory = $true)]
114+
[string] $projectFileName,
115+
[Parameter(mandatory = $true)]
116+
[string] $packageName
117+
)
118+
dotnet add $projectFileName package $packageName
119+
}
120+
121+
Write-Host "Updating project " $ProjectsToInclude.projects
122+
123+
# create new feature branch
124+
Add-NewBranch
125+
126+
# get the cs proj files
127+
$csProjFiles = Get-ChildItem -Path ${GITHUB_WORKSPACE} -Force -Recurse -Include "*.csproj"
128+
Write-Host "CSProj Files: $csProjFiles"
129+
130+
# loop through the cs proj files
131+
foreach ($childItem in $csProjFiles) {
132+
133+
[xml]$xmlElm = Get-Content -Path $childItem
134+
135+
$xmlElm.Project.ItemGroup.PackageReference | Where-Object {
136+
$_.include -ne $null -and $_.include.StartsWith($PackageIdStartsWith)
137+
} | ForEach-Object {
138+
Write-Host "Updating reference " $_.include
139+
Update-WithDotNet -projectFileName $childItem -packageName $_.include
140+
}
141+
}
142+
143+
if (-not (git status --porcelain)) {
144+
Write-Host "Clean!"
145+
Write-Host "All files up-to-date for" ${GITHUB_WORKSPACE}
146+
}
147+
else {
148+
Write-Host "Not Clean!"
149+
# commit branch
150+
Write-Host "Commiting branch."
151+
Push-NewBranch
152+
# create PR
153+
Write-Host "Creating pull request for branch $featureBranch."
154+
Add-PullRequest
155+
}
156+
shell: pwsh
157+
env:
158+
GH_TOKEN: ${{ secrets.AUTOBOT_GITHUB_TOKEN }}

.github/pull-request-validation.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Pull Request Validation
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize, reopened]
5+
6+
jobs:
7+
validate-jira-issues:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: wcenterprises/digital-is-build-actions/jira/[email protected]
12+
with:
13+
jira-token: ${{ secrets.JIRA_TOKEN }}

.github/pull_request_template.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
------------------------------------------
2+
Instructions:
3+
1. This template should be filled in for all pull requests.
4+
2. Give an appropriate title and description.
5+
3. Enter 1 or more comma-delimited JIRA issue IDs after Jira-Tickets
6+
- e.g. Jira-Tickets: DSAND-101, DSAND-103
7+
4. Review the checklist and check items you have completed. If items are not complete, keep them unchecked.
8+
- You should provide information in the description for items that are unchecked.
9+
- Do not remove checklist items. If a checklist item is not applicable, use the strikethrough notation.
10+
- [ ] ~~I've added XML comments where necessary~~.
11+
5. If items in the checklist are incomplete then you should complete those items prior to submitting the pull request.
12+
6. Delete this instructions section prior to submitting the pull request.
13+
14+
_Note: use ![number] to link to PRs, #[number] to link to work items_
15+
16+
------------------------------------------
17+
Description:
18+
19+
Jira-Tickets:
20+
21+
Checklist:
22+
- [ ] I've reviewed the diff myself and ensured the changes are ready for review.
23+
- [ ] I've run code cleanup to format my changes.
24+
- [ ] I've added XML comments where necessary.
25+
- [ ] I've validated that environment configurations have been applied to all environments.
26+
- [ ] I've added or modified tests (unit and/or integration) to cover my changes and all tests are passing.
27+
- [ ] I've validated that my changes do not add compiler warnings.
28+
- [ ] I've built and ran locally to validate my changes.
29+
- [ ] I've updated my work items to reflect the status of this change.
30+
- [ ] I've added documentation to my work items that shows proof that I've validated the results.
31+
- [ ] I've updated appropriate documentation (API spec, wiki, tech design, etc) for my changes.
32+
- [ ] I've validated this change is covered by a feature flag. If a feature flag is not used, I've received approval to complete without.
33+
- [ ] I'm ready to support this change going to Production.

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI
2+
3+
on:
4+
# Allow manual build
5+
workflow_dispatch:
6+
7+
# Build on push to main
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- '**/**'
13+
- '!docs/**'
14+
- '!build/**'
15+
- '!azure-pipelines*'
16+
- '!**/*.md'
17+
- '!**/*.txt'
18+
- '!**/unit-tests.yml'
19+
- '!**/codeql.yml'
20+
21+
# Build every 6 months if not built already
22+
schedule:
23+
- cron: '0 1 1 */6 *'
24+
25+
jobs:
26+
build-project:
27+
name: Build Project
28+
runs-on: windows-latest
29+
steps:
30+
- name: Checkout repository
31+
id: checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: |
38+
6.x
39+
8.x
40+
41+
- uses: nuget/setup-nuget@v2
42+
with:
43+
nuget-version: 'latest'
44+
nuget-api-key: ${{ secrets.AZDO_NUGET_REPO }}
45+
46+
- uses: wcenterprises/digital-is-build-actions/[email protected]
47+
id: build-init
48+
with:
49+
package-name: '[PROJECT-NAME]'
50+
azdo-token: '${{ secrets.AZDO_NUGET_REPO }}'
51+
artifactory-username: ${{ secrets.ARTIFACTORY_USERNAME }}
52+
artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }}
53+
54+
- name: restore
55+
run: |
56+
dotnet restore '[SOLUTION-NAME]'
57+
shell: pwsh
58+
59+
- name: build
60+
run: |
61+
write-output "##[group]build: [SOLUTION-NAME]"
62+
dotnet build '[SOLUTION-NAME]' `
63+
--no-restore `
64+
--configuration release `
65+
-p:Copyright="${{ steps.build-init.outputs.package-copyright }}" `
66+
-p:Authors="${{ steps.build-init.outputs.package-authors }}" `
67+
-p:Company="${{ steps.build-init.outputs.package-company }}" `
68+
-p:AssemblyVersion="${{ steps.build-init.outputs.version-prefix }}" `
69+
-p:FileVersion="${{ steps.build-init.outputs.version-prefix }}" `
70+
-p:InformationalVersion="${{ steps.build-init.outputs.version-informational }}+${{ github.sha }}" `
71+
-p:TrimUnusedDependencies=true `
72+
-p:IsOnBuildAgent=true `
73+
-p:CodeAnalysisTreatWarningsAsErrors=true `
74+
-warnaserror `
75+
-p:_SkipUpgradeNetAnalyzersNuGetWarning=true
76+
write-output "##[endgroup]"
77+
shell: pwsh
78+
working-directory: '${{ github.workspace }}/source'
79+
80+
- name: publish
81+
run: |
82+
write-output "##[group]publish: [SOLUTION-NAME]"
83+
dotnet publish [SOLUTION-NAME] `
84+
--property:PublishDir="${{ steps.build-init.outputs.build-output-path }}" `
85+
--configuration release `
86+
--no-build `
87+
--no-self-contained `
88+
--no-restore `
89+
--nologo `
90+
-p:TrimUnusedDependencies=true `
91+
-p:ErrorOnDuplicatePublishOutputFiles=false
92+
write-output "##[endgroup]"
93+
shell: pwsh
94+
working-directory: '${{ github.workspace }}/source'
95+
96+
- uses: wcenterprises/digital-is-build-actions/[email protected]
97+
98+
- uses: wcenterprises/digital-is-build-actions/[email protected]
99+

0 commit comments

Comments
 (0)