diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ead1a1b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Info + run: echo 'Building ${{ github.ref }}' + + - uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.100 + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.11.0 + with: + mongodb-version: '8.0' + + - name: Build & Test + run: make test config=Release + + publish: + if: contains(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-latest + + steps: + - name: Info + run: echo 'Building ${{ github.ref }}' + + - uses: actions/checkout@v1 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.100 + + - name: Build nuget + run: make nuget config=Release version=${GITHUB_REF#refs/tags/} + + - name: publish nuget + run: make publish nugetkey=${{secrets.NUGET_KEY}} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d0de335 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +config ?= Debug +version ?= 0.0.0 + + +build: + dotnet build + +test: + dotnet test + +nuget: + dotnet pack -c $(config) -p:Version=$(version) -o .out + +publish: .out/*.nupkg + @for file in $^ ; do \ + dotnet nuget push $$file -k $(nugetkey) -s https://api.nuget.org/v3/index.json --skip-duplicate ; \ + done