Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MattEdwardsWaggleBee authored Aug 28, 2024
0 parents commit ef9570f
Show file tree
Hide file tree
Showing 25 changed files with 1,382 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
34 changes: 34 additions & 0 deletions .github/issue-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
defaultBranch: 'develop'
branchName: '${issue.number}:${issue.title,}'
mode: auto
gitSafeReplacementChar: '-'
branches:
- label : feature
prefix: feature/
name: develop
prTarget: develop
skip: false
- label : bug
prefix: bugfix/
name: develop
prTarget: develop
skip: false
- label : critical
prefix: hotfix/
name: main
prTarget: main
skip: false
- label : documentation
prefix: doc/
name: main
prTarget: main
- label : '*'
skip: true


prSkipCI: true
copyIssueDescriptionToPR: true
copyIssueLabelsToPR: true
copyIssueAssigneeToPR: true
openDraftPR: true
autoCloseIssue: true
58 changes: 58 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Create Release

on:
workflow_dispatch:
inputs:
is_prerelease:
description: 'Create a prerelease:'
type: boolean
required: true
default: false
is_draft:
description: 'Set as a draft:'
type: boolean
required: true
default: false

env:
ALLOW_PRERELEASE: ${{ startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/') }}

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: Check For Valid Prerelease
if: ${{ ( env.ALLOW_PRERELEASE == 'true' && github.event.inputs.is_prerelease == 'false' ) || ( github.ref == 'refs/heads/main' && github.event.inputs.is_prerelease == 'true' ) }}
run: |
echo "Prereleases should not be triggered on the main branch, please use development or hotfix"
exit 1
- name: Checkout Code
uses: actions/checkout@v4

- name: Get Current Version
id: get_version
shell: pwsh
run: |
Import-Module ./solution-helper.psm1 -Force
$version = Get-Version
if ("${{ github.event.inputs.is_prerelease }}" -eq "true") {
$version_tag = "$version-develop.$(date +'%y%m%d%H%M%S')"
} else {
$version_tag = $version
}
echo "version_tag=$version_tag" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Create Release
run: |
echo "🎁 Creating release ${{ env.version_tag }}"
gh release create ${{ env.version_tag }} \
--target ${{ github.ref_name }} \
--title ${{ env.version_tag }} \
--generate-notes \
$(if [[ "${{ github.event.inputs.is_draft }}" == "true" ]]; then echo "--draft"; fi) \
$(if [[ "${{ github.event.inputs.is_prerelease }}" == "true" ]]; then echo "--prerelease"; fi) \
$(if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "--latest"; fi)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
42 changes: 42 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Format

on:
push:
workflow_run:
workflows:
- Create Prerelease
- Create Release
types: [requested]
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
branches:
- main
- develop

env:
DOTNET_VERSION: "8.0.x"

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Format
run: dotnet format

- name: Update Styles
continue-on-error: true
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git commit -am "Updated code formatting to match rules in .editorconfig"
git push
23 changes: 23 additions & 0 deletions .github/workflows/issue-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Create Issue Branch

on:
# The issue.opened event below is only needed for the "immediate" mode.
# The issue.assigned event below is only needed for the default ("auto") mode.
issues:
types: [ opened, assigned ]
# The issue_comment.created event below is only needed for the ChatOps mode.
issue_comment:
types: [ created ]
# The pull_request events below are only needed for pull-request related features.
pull_request:
types: [ opened, closed ]

jobs:
create_issue_branch_job:
runs-on: ubuntu-latest
steps:
- name: Create Issue Branch
id: Create_Issue_Branch
uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83 changes: 83 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Publish

on:
workflow_dispatch:
release:
types: [published]

env:
BRANCH_NAME: ${{ github.event.release.target_commitish }}
SOLUTION_NAME: ${{ vars.SOLUTION_NAME }}
DOTNET_VERSION: '8.0.x'
NUGET_SOURCE: 'https://api.nuget.org/v3/index.json'
BUILD_CONFIGURATION: ''
VERSION_SUFFIX: ''

jobs:
build-publish:
runs-on: ubuntu-latest

steps:
- name: Release Configuration
if: ${{ env.BRANCH_NAME == 'main' && (github.event.release.prerelease == false || github.event_name == 'workflow_dispatch') }}
run: |
echo "BUILD_CONFIGURATION=Release" >> $GITHUB_ENV
- name: Debug Configuration
if: ${{ (github.event.release.prerelease || github.event_name == 'workflow_dispatch') }}
run: |
echo "BUILD_CONFIGURATION=Debug" >> $GITHUB_ENV
- name: Check Build Configuration
if: ${{ env.BUILD_CONFIGURATION == '' }}
run: |
echo "Invalid Build Configuration"
exit 1
- name: Checkout Code
uses: actions/checkout@v4

- name: Get Current Version
id: get_version
shell: pwsh
run: |
Import-Module ./solution-helper.psm1 -Force
$build_version = Get-Version
echo "build_version=$build_version" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Get Version Suffix
id: get_version_suffix
shell: bash
run: |
# Fetch the list of releases
releases=$(gh release list --json createdAt,tagName --limit 100)
# Filter the releases based on the starting version number, sort them by date, and extract the most recent one
latest_release=$(echo "$releases" | jq -r --arg build_version "$build_version" 'map(select(.tagName | startswith($build_version))) | sort_by(.createdAt) | reverse | .[0] | .tagName')
version_suffix=${latest_release#*$build_version-}
if [ "$version_suffix" == "$build_version" ]; then
version_suffix=""
fi
echo "VERSION_SUFFIX=$version_suffix" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore Dependencies
run: dotnet restore ${{ env.SOLUTION_NAME }}

- name: Build
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_NAME }}

- name: Test
run: dotnet test --no-build --verbosity normal --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_NAME }}

- name: Pack and Push
run: dotnet pack --no-build --configuration ${{ env.BUILD_CONFIGURATION }} -p:PackageOutputPath=../../output --version-suffix "${{ env.VERSION_SUFFIX }}" -p:PackageSource='${{ env.NUGET_SOURCE }}' -p:PushAfterPack=true -p:PackageApiKey='${{ secrets.NUGET_API_KEY }}'
29 changes: 29 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test Report
run-name: Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }}

# https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
# This workflow is for test report

on:
workflow_run:
workflows: [ "Test" ]
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Test Report 🧪
uses: dorny/test-reporter@v1
with:
artifact: test-results
name: Unit Tests
path: "*.trx"
reporter: dotnet-trx
fail-on-error: false
Loading

0 comments on commit ef9570f

Please sign in to comment.