Skip to content

Commit

Permalink
Merge pull request #71 from Stravaig-Projects/#60-bring-this-repo-in-…
Browse files Browse the repository at this point in the history
…line-with-others

#60 Bring this repo in-line with others
  • Loading branch information
colinangusmackay committed Jan 9, 2021
2 parents de941d9 + 94bcb06 commit 859275c
Show file tree
Hide file tree
Showing 21 changed files with 1,046 additions and 86 deletions.
34 changes: 34 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# <title>

<!--
Thank you for taking the time to contribute to this project.
Please, fill in all the sections.
Replace items surrounded by chevrons appropriately.
-->

## Issue

This PR addresses Issue #<issue-number>.

<!-- Fill in any additional notes about the PR here -->

## Check list

### Required

- [ ] I have updated `release-notes/wip-release-notes.md` file
- [ ] I have addressed style warnings given by Visual Studio/ReSharper/Rider
- [ ] I have checked that all tests pass.

### Optional

<!--
Depending on what the PR is for these may not be needed.
If any of these items are not needed, then they can be removed.
-->

- [ ] I have updated the `readme.md` file
- [ ] I have bumped the version number in the `version.txt`
- [ ] I have added or updated any necessary tests.
- [ ] I have ensured that any new code is covered by tests where reasonably possible.
111 changes: 96 additions & 15 deletions .github/workflows/build-gedcom-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ on:
- main
paths-ignore:
- 'README.md'
- 'Example/**'
- '.vscode/**'
- '.gitignore'
- 'contributors.md'
- 'release-notes/**'
- '.github/PULL_REQUEST_TEMPLATE/**'
- 'src/.idea/**'
- 'docs/**'

pull_request:
types: [assigned, opened, synchronize, reopened]
paths-ignore:
- 'README.md'
- 'Example/**'
- '.vscode/**'
- '.gitignore'
- 'contributors.md'
- 'release-notes/**'
- '.github/PULL_REQUEST_TEMPLATE/**'
- 'src/.idea/**'
- 'docs/**'

workflow_dispatch:
inputs:
Expand All @@ -33,46 +45,115 @@ jobs:
runs-on: ubuntu-latest
env:
STRAVAIG_SOLUTION: ./src/Gedcom.sln
STRAVAIG_UNIT_TESTS: ./src/Stravaig.Gedcom.UnitTests
STRAVAIG_PACKAGE_PROJECT: src/Stravaig.Gedcom/Stravaig.Gedcom.csproj
STRAVAIG_TESTS: ./src/Stravaig.Gedcom.UnitTests
STRAVAIG_PROJECT: Stravaig.Gedcom

steps:
- uses: actions/checkout@v2
name: Checking out the source code
with:
fetch-depth: 0

- name: Set version number
shell: pwsh
run: ./Set-Version.ps1 -IsPublic "${{ github.event.inputs.isPublic }}" -IsPreview "${{ github.event.inputs.isPreview }}"

- name: Display workflow state
run: |
echo "Solution: $STRAVAIG_SOLUTION"
echo "Unit tests: $STRAVAIG_UNIT_TESTS"
echo "Package project: $STRAVAIG_PACKAGE_PROJECT"
echo "Package version: $STRAVAIG_PACKAGE_VERSION"
echo "Version Suffix: $STRAVAIG_PACKAGE_VERSION_SUFFIX"
echo "Publish To NuGet: $STRAVAIG_PUBLISH_TO_NUGET"
echo "Solution: $STRAVAIG_SOLUTION"
echo "STRAVAIG_SOLUTION: $STRAVAIG_SOLUTION"
echo "STRAVAIG_PROJECT: $STRAVAIG_PROJECT"
echo "STRAVAIG_TESTS: $STRAVAIG_TESTS"
echo "STRAVAIG_PACKAGE_VERSION: $STRAVAIG_PACKAGE_VERSION"
echo "STRAVAIG_PACKAGE_VERSION_SUFFIX: $STRAVAIG_PACKAGE_VERSION_SUFFIX"
echo "STRAVAIG_PACKAGE_FULL_VERSION: $STRAVAIG_PACKAGE_FULL_VERSION"
echo "STRAVAIG_PUBLISH_TO_NUGET: $STRAVAIG_PUBLISH_TO_NUGET"
echo "STRAVAIG_IS_PREVIEW: $STRAVAIG_IS_PREVIEW"
echo "STRAVAIG_IS_STABLE: $STRAVAIG_IS_STABLE"
- uses: actions/setup-dotnet@v1
name: Setup .NET Core
with:
dotnet-version: 3.1.402
dotnet-version: 3.1.x

- name: Build Solution
run: dotnet build ${{ env.STRAVAIG_SOLUTION }} --configuration Release

- name: Test solution
run: dotnet test ${{ env.STRAVAIG_UNIT_TESTS }} --configuration Release
run: dotnet test ${{ env.STRAVAIG_TESTS }} --configuration Release

- name: Package Preview Release
if: ${{ env.STRAVAIG_PACKAGE_VERSION_SUFFIX != '~' }}
run: dotnet pack ${{ env.STRAVAIG_PACKAGE_PROJECT }} --configuration Release --output ./out --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" --version-suffix "$STRAVAIG_PACKAGE_VERSION_SUFFIX" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
if: ${{ env.STRAVAIG_IS_PREVIEW == 'true' }}
run: dotnet pack ./src/$STRAVAIG_PROJECT/$STRAVAIG_PROJECT.csproj --configuration Release --output ./out --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" --version-suffix "$STRAVAIG_PACKAGE_VERSION_SUFFIX" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg

- name: Package Stable Release
if: ${{ env.STRAVAIG_PACKAGE_VERSION_SUFFIX == '~' }}
run: dotnet pack ${{ env.STRAVAIG_PACKAGE_PROJECT }} --configuration Release --output ./out --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
if: ${{ env.STRAVAIG_IS_STABLE == 'true' }}
run: dotnet pack ./src/$STRAVAIG_PROJECT/$STRAVAIG_PROJECT.csproj --configuration Release --output ./out --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg

- name: Push package to NuGet
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' }}
run: dotnet nuget push ./out/*.nupkg --api-key ${{ secrets.STRAVAIG_NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: List Contributors
shell: pwsh
run: ./list-contributors.ps1

- name: Build Release Notes
shell: pwsh
run: ./build-release-notes.ps1

- name: Archive Simulated Release Notes
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'false' }}
uses: actions/upload-artifact@v2
with:
name: simulated-release-information
path: |
contributors.md
release-notes/full-release-notes.md
release-notes/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md
retention-days: 7

- name: Archive Release Notes
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' }}
uses: actions/upload-artifact@v2
with:
name: release-information
path: |
contributors.md
release-notes/full-release-notes.md
release-notes/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md
- name: Mark Release
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' }}
uses: ncipollo/release-action@v1
with:
artifacts: "./out/*.nupkg,./out/*.snupkg,LICENSE,contributors.md,readme.md,./release-notes/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md"
token: ${{ secrets.GITHUB_TOKEN }}
bodyFile: "release-body.md"
prerelease: ${{ env.STRAVAIG_IS_PREVIEW }}
commit: ${{ env.GITHUB_SHA }}
tag: v${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}
draft: false

- name: Bump version
#IF Publishing & Stable release
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' && env.STRAVAIG_IS_STABLE == 'true' }}
shell: pwsh
run: ./Bump-Version.ps1 -BumpPatch

- name: Reset WIP release notes
#IF Publishing & Stable release
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' && env.STRAVAIG_IS_STABLE == 'true' }}
shell: pwsh
run: ./Reset-WipReleaseNotes.ps1

- name: Commit post release updates
#IF Publishing & Stable release
if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' && env.STRAVAIG_IS_STABLE == 'true' }}
uses: EndBug/add-and-commit@v5
with:
add: ./contributors.md ./release-notes/** ./version.txt
author_name: StravaigBot
author_email: stravaig@colinmackay.scot
message: "[bot] Bump Version & Post v${{ env.STRAVAIG_PACKAGE_FULL_VERSION }} Release updates."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 81 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,84 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/


# Sphinx/Read-the-Docs build folders

docs/build/
docs/_build/
docs/source/_build

# Below this line take from: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
# -----------------------------------------------------------------------------
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
**/.idea/**/workspace.xml
**/.idea/**/tasks.xml
**/.idea/**/usage.statistics.xml
**/.idea/**/dictionaries
**/.idea/**/shelf

# Generated files
**/.idea/**/contentModel.xml

# Sensitive or high-churn files
**/.idea/**/dataSources/
**/.idea/**/dataSources.ids
**/.idea/**/dataSources.local.xml
**/.idea/**/sqlDataSources.xml
**/.idea/**/dynamic.xml
**/.idea/**/uiDesigner.xml
**/.idea/**/dbnavigator.xml

# Gradle
**/.idea/**/gradle.xml
**/.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
**/.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
**/.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
**/.idea/httpRequests

# Android studio 3.1+ serialized cache file
**/.idea/caches/build_file_checksums.ser
26 changes: 26 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
builder: html
fail_on_warning: true

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally set the version of Python and requirements required to build your docs
# python:
# version: 3.7
# install:
# - requirements: docs/requirements.txt
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"cSpell.words": [
"Gedcom",
"Stravaig",
"nuget",
"nupkg",
"pwsh",
"snupkg"
]
}
53 changes: 53 additions & 0 deletions Bump-Version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[CmdletBinding()]
param (
[Switch]
$BumpMajor,

[Switch]
$BumpMinor,

[Switch]
$BumpPatch
)

$VersionFile = "$PSScriptRoot/version.txt";
$currentVersion = Get-Content $VersionFile -ErrorAction Stop
if ($null -eq $currentVersion)
{
Write-Error "The $VersionFile file is empty"
Exit 1
}
if ($currentVersion.GetType().BaseType.Name -eq "Array")
{
$currentVersion = $currentVersion[0]
Write-Warning "$VersionFile contains more than one line of text. Using the first line."
}
if ($currentVersion -notmatch "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
{
Write-Error "The contents of $VersionFile (`"$nextVersion`") not recognised as a valid version number."
Exit 2
}

$parts = $currentVersion.Split('.');
[int]$major = $parts[0]
[int]$minor = $parts[1]
[int]$patch = $parts[2]

if ($BumpMajor)
{
$major += 1;
}

if ($BumpMinor)
{
$minor += 1;
}

if ($BumpPatch)
{
$patch += 1;
}

$newVersion = "$major.$minor.$patch";

Set-Content $VersionFile $newVersion -Encoding UTF8 -Force
16 changes: 16 additions & 0 deletions Reset-WipReleaseNotes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$content = @(
"# Release Notes",
"",
"## Version X",
"",
"Date: ???",
""
"### Bugs"
"",
"### Features",
"",
"### Miscellaneous",
""
)

Set-Content "$PSScriptRoot/release-notes/wip-release-notes.md" $content -Encoding UTF8 -Force

0 comments on commit 859275c

Please sign in to comment.