diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..6166f4f --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + + - name: Restore BotPages + run: dotnet restore BotPages + + - name: Build BotPages + run: dotnet build BotPages --no-restore -c Release + + - name: Test BotPages + run: dotnet test BotPages --no-build -c Release --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx" + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: | + **/TestResults/*.trx + **/TestResults/*/coverage.cobertura.xml diff --git a/.gitea/workflows/release-package.yaml b/.gitea/workflows/release-package.yaml new file mode 100644 index 0000000..0c4bd7a --- /dev/null +++ b/.gitea/workflows/release-package.yaml @@ -0,0 +1,54 @@ +name: Release + +on: + release: + types: [published] + +jobs: + pack-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Set version from tag + id: version + run: | + TAG="${GITHUB_REF_NAME#v}" + echo "PACKAGE_VERSION=$TAG" >> $GITHUB_OUTPUT + + - name: Build and Pack projects + run: | + mkdir -p artifacts + for proj in $PROJECTS; do + echo "Restoring $proj..." + dotnet restore $proj + echo "Building $proj..." + dotnet build $proj -c Release -p:Version=${{ steps.version.outputs.PACKAGE_VERSION }} + echo "Packing $proj..." + dotnet pack $proj -c Release --no-build -p:PackageVersion=${{ steps.version.outputs.PACKAGE_VERSION }} -o ./artifacts + done + env: + PROJECTS: | + BotPages.Core + BotPages.Telegram + BotPages + + - name: Upload package artifact + uses: actions/upload-artifact@v3 + with: + name: nuget-packages + path: artifacts/*.nupkg + + - name: Publish to NuGet + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push ./artifacts/*.nupkg --source https://git.frigat.duckdns.org/api/packages/FrigaT/nuget/index.json --api-key $NUGET_API_KEY --skip-duplicate \ No newline at end of file diff --git a/BotPages.slnx b/BotPages.slnx index f78380c..693a753 100644 --- a/BotPages.slnx +++ b/BotPages.slnx @@ -1,4 +1,7 @@ + + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8aa2645 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..91ba526 --- /dev/null +++ b/nuget.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file