ci: adjusting woodpecker to use just
This commit is contained in:
parent
7e319b0881
commit
c1b3fd36c9
|
@ -1,36 +1,23 @@
|
|||
# clone:
|
||||
# git:
|
||||
# image: woodpeckerci/plugin-git
|
||||
# settings:
|
||||
# tags: true
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git
|
||||
settings:
|
||||
tags: true
|
||||
|
||||
# pipeline:
|
||||
# build:
|
||||
# image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||
# commands:
|
||||
# - nix develop --command scripts/build.sh
|
||||
# when:
|
||||
# event: [push, pull_request, tag]
|
||||
# tag: v*
|
||||
pipeline:
|
||||
build:
|
||||
image: nixpkgs/nix-flakes
|
||||
commands:
|
||||
- nix develop --command just build test
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
|
||||
# test:
|
||||
# image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||
# commands:
|
||||
# - nix develop --command scripts/test.sh
|
||||
# when:
|
||||
# event: [push, pull_request]
|
||||
# #paths:
|
||||
# # - ./**/*test-result.xml
|
||||
# # - ./coverage/Cobertura.xml
|
||||
# # - ./coverage/Summary.*
|
||||
# # - ./**/*.nupkg
|
||||
|
||||
# release-main:
|
||||
# image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||
# commands:
|
||||
# - nix develop --command scripts/release.sh
|
||||
# secrets:
|
||||
# - gitea_token
|
||||
# when:
|
||||
# event: push
|
||||
# branch: main
|
||||
release:
|
||||
image: nixpkgs/nix-flakes
|
||||
commands:
|
||||
- nix develop --command just release
|
||||
secrets:
|
||||
- gitea_token
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
|
|
43
Justfile
43
Justfile
|
@ -3,6 +3,10 @@ set dotenv-load := true
|
|||
@_default:
|
||||
just --choose
|
||||
|
||||
# Cleans out the packages.
|
||||
clean:
|
||||
dotnet clean
|
||||
|
||||
# Builds all of the components of this repository.
|
||||
build:
|
||||
dotnet build
|
||||
|
@ -29,3 +33,42 @@ restore-tools:
|
|||
# Restores all the NuGet packages.
|
||||
restore-packages:
|
||||
dotnet restore
|
||||
|
||||
# Performs a release on all the packages.
|
||||
release: clean build
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Verify that all the variables are set.
|
||||
if [ "x$GITEA_TOKEN" = "x" ]; then
|
||||
echo "the environment variable GITEA_TOKEN is not defined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Publish the packages.
|
||||
dotnet pack -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg || exit 1
|
||||
dotnet nuget remove source publish >&/dev/null
|
||||
#dotnet nuget add source --name publish --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 publish src/*/bin/Debug/*.nupkg || exit 1
|
||||
dotnet nuget remove source publish >&/dev/null
|
||||
|
||||
# Go through and tag everything.
|
||||
git remote add publish https://dmoonfire:$GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url))
|
||||
|
||||
for i in src/*/GitVersion.yml
|
||||
do
|
||||
# Move into the proper directory.
|
||||
dir=$(dirname $i)
|
||||
pkg=$(basename $dir)
|
||||
pushd $dir
|
||||
|
||||
# Check the version and see if we've tagged it already.
|
||||
tag="$pkg-$(dotnet gitversion /output json | jq -r .SemVer)"
|
||||
echo "tagging $pkg with $tag"
|
||||
#git tag $tag
|
||||
#git push publish $tag
|
||||
|
||||
# Move back so we can finish.
|
||||
popd
|
||||
done
|
||||
|
||||
git remote remove publish
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# Scripts Directory
|
||||
|
||||
This directory contains the basic scripts for working with the library.
|
||||
|
||||
## `setup.sh`
|
||||
|
||||
This verifies the environment is correct and makes sure everything is configured.
|
||||
|
||||
## `build.sh`
|
||||
|
||||
This builds the project and creates the binaries in debug mode.
|
||||
|
||||
## `test.sh`
|
||||
|
||||
This runs any required tests.
|
||||
|
||||
## `format.sh`
|
||||
|
||||
This is used to format the code base using our standards. It matches the commands in the `lefthook` pre-commit hook.
|
||||
|
||||
## `release.sh`
|
||||
|
||||
Intended to run in a CI environment, this creates a NuGet package and publishes it.
|
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
cd $(dirname $0)/..
|
||||
./scripts/setup.sh || exit 1
|
||||
|
||||
# Verify the input.
|
||||
if [ "x$GITEA_TOKEN" = "x" ]; then
|
||||
echo "the environment variable GITEA_TOKEN is not defined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up everything from the previous runs.
|
||||
echo "$(basename $0): cleaning project"
|
||||
dotnet clean
|
||||
|
||||
# Version the file based on the Git repository.
|
||||
echo "$(basename $0): setting project version"
|
||||
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
|
||||
SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)"
|
||||
|
||||
if [ "x$SEMVER" = "x" ]; then
|
||||
echo "$(basename $0): cannot figure out the semantic version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build to pick up the new version.
|
||||
echo "$(basename $0): building project $SEMVER"
|
||||
dotnet build || exit 1
|
||||
|
||||
# Create and publish the NuGet packages.
|
||||
echo "$(basename $0): creating NuGet packages"
|
||||
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.
|
||||
if ! git tag | grep $SEMVER >&/dev/null; then
|
||||
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 push publish $SEMVER || exit 1
|
||||
git remote remove publish
|
||||
else
|
||||
echo "$(basename $0): not tagging, already exists"
|
||||
fi
|
Loading…
Reference in a new issue