Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-edmondson committed Jan 13, 2025
0 parents commit 04d4a4a
Show file tree
Hide file tree
Showing 23 changed files with 2,359 additions and 0 deletions.
452 changes: 452 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# From: https://rehansaeed.com/gitattributes-best-practices/

###############################
# Git Line Endings #
###############################

# Set default behaviour to automatically normalize line endings.
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf

###############################
# Git Large File System (LFS) #
###############################

# Archives
*.7z filter=lfs diff=lfs merge=lfs -text
*.br filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

# Documents
*.pdf filter=lfs diff=lfs merge=lfs -text

# Images
*.gif filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text

# Fonts
*.woff2 filter=lfs diff=lfs merge=lfs -text

# Other
*.exe filter=lfs diff=lfs merge=lfs -text
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
groups:
ktsu:
patterns:
- "ktsu.*"
Microsoft:
patterns:
- "Microsoft.*"
System:
patterns:
- "System.*"
Silk:
patterns:
- "Silk.NET.*"
23 changes: 23 additions & 0 deletions .github/workflows/dependabot-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-major' || steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
163 changes: 163 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: .NET Workflow

on:
push:
branches:
- main
- develop
pull_request:
schedule:
- cron: "0 23 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

permissions:
packages: write
contents: write

env:
OUTPUT_PATH: 'output'
STAGING_PATH: 'staging'
DOTNET_VERSION: '9.0'

jobs:
dotnet:
name: .NET Workflow
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: true
lfs: true
fetch-tags: true

- name: Fetch tags
shell: pwsh
run: |
git fetch --prune --unshallow --tags
$global:LASTEXITCODE = 0
- name: Configure Environment
shell: pwsh
run: |
$IS_MAIN = "${{ github.ref }}" -eq "refs/heads/main"
$IS_TAGGED = (git show-ref --tags -d | Out-String).Contains("${{ github.sha }}")
$SHOULD_RELEASE = ($IS_MAIN -AND -NOT $IS_TAGGED)
$USE_DOTNET_SCRIPT = (Get-ChildItem -Recurse -Filter *.csx).Count -gt 0
$PACKAGE_PATTERN = Join-Path -Path "${{ github.workspace }}" -ChildPath "${{ env.STAGING_PATH }}" -AdditionalChildPath "*.nupkg"
$SYMBOLS_PATTERN = Join-Path -Path "${{ github.workspace }}" -ChildPath "${{ env.STAGING_PATH }}" -AdditionalChildPath "*.snupkg"
$APPLICATION_PATTERN = Join-Path -Path "${{ github.workspace }}" -ChildPath "${{ env.STAGING_PATH }}" -AdditionalChildPath "*.zip"
$BUILD_ARGS = ""
$BUILD_ARGS += $USE_DOTNET_SCRIPT ? "-maxCpuCount:1" : ""
"IS_MAIN=$IS_MAIN" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"IS_TAGGED=$IS_TAGGED" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"SHOULD_RELEASE=$SHOULD_RELEASE" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"USE_DOTNET_SCRIPT=$USE_DOTNET_SCRIPT" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"PACKAGE_PATTERN=$PACKAGE_PATTERN" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"SYMBOLS_PATTERN=$SYMBOLS_PATTERN" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"APPLICATION_PATTERN=$APPLICATION_PATTERN" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"BUILD_ARGS=$BUILD_ARGS" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "IS_MAIN: $IS_MAIN"
Write-Host "IS_TAGGED: $IS_TAGGED"
Write-Host "SHOULD_RELEASE: $SHOULD_RELEASE"
Write-Host "USE_DOTNET_SCRIPT: $USE_DOTNET_SCRIPT"
Write-Host "PACKAGE_PATTERN: $PACKAGE_PATTERN"
Write-Host "SYMBOLS_PATTERN: $SYMBOLS_PATTERN"
Write-Host "APPLICATION_PATTERN: $APPLICATION_PATTERN"
Write-Host "BUILD_ARGS: $BUILD_ARGS"
$global:LASTEXITCODE = 0
- name: Make Version
shell: pwsh
run: scripts/make-version.ps1 "${{ github.sha }}"

- name: Make License
shell: pwsh
run: scripts/make-license.ps1 "${{ github.server_url }}" "${{ github.repository_owner }}" "${{ github.repository }}"

- name: Make Changelog
shell: pwsh
run: scripts/make-changelog.ps1 "${{ env.VERSION }}" "${{ github.sha }}"

- name: Commit Metadata
shell: pwsh
run: scripts/commit-metadata.ps1

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
${{ env.DOTNET_VERSION }}.x
- name: Install dotnet-script
if: ${{ env.USE_DOTNET_SCRIPT == 'True' }}
shell: pwsh
run: dotnet tool install -g dotnet-script

- name: Build
shell: pwsh
run: dotnet build --configuration Release --verbosity normal --no-incremental ${{ env.BUILD_ARGS }}

- name: Test
shell: pwsh
run: dotnet test --configuration Release --verbosity normal --no-build

- name: Detect Dependencies
if: ${{ env.SHOULD_RELEASE == 'True' }}
uses: advanced-security/component-detection-dependency-submission-action@v0.0.2

- name: Package Libraries
if: ${{ env.SHOULD_RELEASE == 'True' }}
shell: pwsh
run: dotnet pack --configuration Release --output ${{ github.workspace }}/${{ env.STAGING_PATH }}

- name: Package Applications
if: ${{ env.SHOULD_RELEASE == 'True' }}
shell: pwsh
run: |
if (Test-Path ${{ github.workspace }}/${{ env.OUTPUT_PATH }}) {
Remove-Item -Recurse -Force ${{ github.workspace }}/${{ env.OUTPUT_PATH }}
}
Get-ChildItem -Recurse -Filter *.csproj | ForEach-Object {
$csproj = $_
$projName = [System.IO.Path]::GetFileNameWithoutExtension($csproj)
$outDir = "${{ github.workspace }}/${{ env.OUTPUT_PATH }}/$projName"
$stageDir = "${{ github.workspace }}/${{ env.STAGING_PATH }}"
$stageFile = "$stageDir/$projName-${{ env.VERSION }}.zip"
New-Item -Path $outDir -ItemType Directory -Force
New-Item -Path $stageDir -ItemType Directory -Force
dotnet publish $csproj --no-build --configuration Release --framework net${{ env.DOTNET_VERSION }} --output $outDir
Compress-Archive -Path $outDir/* -DestinationPath $stageFile
}
- name: Publish Libraries to GitHub
if: ${{ env.SHOULD_RELEASE == 'True' && hashFiles(env.PACKAGE_PATTERN) != '' }}
shell: pwsh
run: dotnet nuget push ${{ env.PACKAGE_PATTERN }} --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate

- name: Publish Libraries to NuGet
if: ${{ env.SHOULD_RELEASE == 'True' && hashFiles(env.PACKAGE_PATTERN) != '' }}
shell: pwsh
run: dotnet nuget push ${{ env.PACKAGE_PATTERN }} --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

- name: Release
if: ${{ env.SHOULD_RELEASE == 'True' }}
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.PACKAGE_PATTERN }},${{ env.SYMBOLS_PATTERN }},${{ env.APPLICATION_PATTERN }}"
tag: v${{ env.VERSION }}
commit: ${{ env.RELEASE_HASH }}
allowUpdates: false
skipIfReleaseExists: true
omitBody: true
generateReleaseNotes: true
replacesArtifacts: false
makeLatest: true
24 changes: 24 additions & 0 deletions .github/workflows/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Add issues and prs to ktsu.dev project

on:
issues:
types:
- opened
- reopened
- transferred
- labeled
pull_request:
types:
- opened
- reopened
- labeled

jobs:
add-to-project:
name: Add to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/ktsu-dev/projects/2
github-token: ${{ secrets.PROJECT_AUTOMATION_TOKEN }}
Loading

0 comments on commit 04d4a4a

Please sign in to comment.