fix: integrating common project layout
This commit is contained in:
parent
11fd5fd0ff
commit
9a713fae0e
8 changed files with 61 additions and 42 deletions
15
NuGet.Config
15
NuGet.Config
|
@ -1,7 +1,16 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
|
<clear />
|
||||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
<add key="mfgames" value="https://www.myget.org/F/mfgames/api/v3/index.json" protocolVersion="3" />
|
<add key="mfgames.com" value="https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json" protocolVersion="3" />
|
||||||
</packageSources>
|
</packageSources>
|
||||||
|
<packageSourceMapping>
|
||||||
|
<packageSource key="nuget.org">
|
||||||
|
<package pattern="*" />
|
||||||
|
</packageSource>
|
||||||
|
<packageSource key="mfgames.com">
|
||||||
|
<package pattern="MfGames.*" />
|
||||||
|
</packageSource>
|
||||||
|
</packageSourceMapping>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
12
flake.lock
12
flake.lock
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1648297722,
|
"lastModified": 1659877975,
|
||||||
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1648390671,
|
"lastModified": 1662019588,
|
||||||
"narHash": "sha256-u69opCeHUx3CsdIerD0wVSR+DjfDQjnztObqfk9Trqc=",
|
"narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ce8cbe3c01fd8ee2de526ccd84bbf9b82397a510",
|
"rev": "2da64a81275b68fdad38af669afeda43d401e94b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
18
lefthook.yml
18
lefthook.yml
|
@ -1,9 +1,3 @@
|
||||||
pre-push:
|
|
||||||
parallel: true
|
|
||||||
commands:
|
|
||||||
commit-check:
|
|
||||||
run: convco check -n 30
|
|
||||||
|
|
||||||
pre-commit:
|
pre-commit:
|
||||||
parallel: true
|
parallel: true
|
||||||
commands:
|
commands:
|
||||||
|
@ -14,3 +8,15 @@ pre-commit:
|
||||||
run: prettier . --write --loglevel warn
|
run: prettier . --write --loglevel warn
|
||||||
nixfmt:
|
nixfmt:
|
||||||
run: nixfmt flake.nix
|
run: nixfmt flake.nix
|
||||||
|
|
||||||
|
commit-msg:
|
||||||
|
commands:
|
||||||
|
commit-check:
|
||||||
|
run: convco check -n 1
|
||||||
|
|
||||||
|
skip_output:
|
||||||
|
- meta # Skips lefthook version printing
|
||||||
|
- summary # Skips summary block (successful and failed steps) printing
|
||||||
|
- success # Skips successful steps printing
|
||||||
|
- failure # Skips failed steps printing
|
||||||
|
- execution # Skips printing successfully executed commands and their output (but still prints failed executions)
|
||||||
|
|
|
@ -3,4 +3,5 @@
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
./scripts/setup.sh || exit 1
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
echo "$(basename $0): building project"
|
||||||
dotnet build
|
dotnet build
|
||||||
|
|
|
@ -1,14 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# Normalize our environment.
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
./scripts/setup.sh || exit 1
|
lefthook run pre-commit
|
||||||
|
|
||||||
# Format the .NET code
|
|
||||||
dotnet format || exit 1
|
|
||||||
|
|
||||||
# Format using Prettier.
|
|
||||||
prettier . --write --loglevel warn
|
|
||||||
|
|
||||||
# Format the Flake.
|
|
||||||
nixfmt flake.nix
|
|
||||||
|
|
|
@ -4,44 +4,48 @@ cd $(dirname $0)/..
|
||||||
./scripts/setup.sh || exit 1
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
# Verify the input.
|
# Verify the input.
|
||||||
if [ "x$NUGET_TOKEN" = "x" ]
|
if [ "x$GITEA_TOKEN" = "x" ]
|
||||||
then
|
then
|
||||||
echo "the environment variable NUGET_TOKEN is not defined"
|
echo "the environment variable GITEA_TOKEN is not defined"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$NUGET_PUSH_URL" = "x" ]
|
|
||||||
then
|
|
||||||
echo "the environment variable NUGET_PUSH_URL is not defined"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up everything from the previous runs.
|
# Clean up everything from the previous runs.
|
||||||
|
echo "$(basename $0): cleaning project"
|
||||||
dotnet clean
|
dotnet clean
|
||||||
|
|
||||||
# Version the file based on the Git repository.
|
# Version the file based on the Git repository.
|
||||||
|
echo "$(basename $0): setting project version"
|
||||||
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
|
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
|
||||||
SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)"
|
SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)"
|
||||||
|
|
||||||
if [ "x$SEMVER" = "x" ]
|
if [ "x$SEMVER" = "x" ]
|
||||||
then
|
then
|
||||||
echo "cannot figure out the semantic version"
|
echo "$(basename $0): cannot figure out the semantic version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build to pick up the new version.
|
# Build to pick up the new version.
|
||||||
dotnet build
|
echo "$(basename $0): building project $SEMVER"
|
||||||
|
dotnet build || exit 1
|
||||||
|
|
||||||
# Create and publish the NuGet packages.
|
# Create and publish the NuGet packages.
|
||||||
dotnet pack --include-symbols --include-source
|
echo "$(basename $0): creating NuGet packages"
|
||||||
dotnet nuget push src/*/bin/Debug/*.nupkg --api-key $NUGET_TOKEN --source $NUGET_PUSH_URL
|
dotnet pack -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg || exit 1
|
||||||
|
|
||||||
|
echo "$(basename $0): publishing NuGet package"
|
||||||
|
dotnet nuget remove source mfgames.com >& /dev/null
|
||||||
|
dotnet nuget add source --name mfgames.com --username dmoonfire --password $GITEA_TOKEN https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json --store-password-in-clear-text || exit 1
|
||||||
|
dotnet nuget push --skip-duplicate --source mfgames.com src/*/bin/Debug/*.nupkg || exit 1
|
||||||
|
|
||||||
# Tag and push, but only if we don't have a tag.
|
# Tag and push, but only if we don't have a tag.
|
||||||
if ! git tag | grep $SEMVER >& /dev/null
|
if ! git tag | grep $SEMVER >& /dev/null
|
||||||
then
|
then
|
||||||
echo "tagging and pushing"
|
echo "$(basename $0): tagging and pushing"
|
||||||
|
git remote add publish https://dmoonfire:$GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url))
|
||||||
git tag $SEMVER
|
git tag $SEMVER
|
||||||
git push origin $SEMVER
|
git push publish $SEMVER || exit 1
|
||||||
|
git remote remove publish
|
||||||
else
|
else
|
||||||
echo "not tagging, already exists"
|
echo "$(basename $0): not tagging, already exists"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -14,9 +14,14 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Make sure we have lefthook is installed.
|
# Make sure we have lefthook is installed.
|
||||||
lefthook install
|
if [ ! -f .git/hooks/pre-commit ]
|
||||||
|
then
|
||||||
|
echo "$(basename $0): installing lefthook"
|
||||||
|
lefthook install
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure our tools are installed.
|
# Make sure our tools are installed.
|
||||||
|
echo "$(basename $0): install .NET tools"
|
||||||
dotnet tool restore
|
dotnet tool restore
|
||||||
|
|
||||||
# Everything is good.
|
# Everything is good.
|
||||||
|
|
4
scripts/update-template.sh
Executable file
4
scripts/update-template.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
git pull template main --no-rebase
|
Reference in a new issue