From 9d0fde93f844d398c3780d2fc916781defbb8fa1 Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Tue, 1 Oct 2024 23:18:55 -0400 Subject: [PATCH] ci: added github workflows for packages --- .github/semantic.yml | 2 ++ .github/workflows/on-pr.yml | 26 ++++++++++++++ .github/workflows/on-push.yml | 66 +++++++++++++++++++++++++++++++++++ GitVersion.yml | 10 ++++++ 4 files changed, 104 insertions(+) create mode 100644 .github/semantic.yml create mode 100644 .github/workflows/on-pr.yml create mode 100644 .github/workflows/on-push.yml create mode 100644 GitVersion.yml diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000..2e1a849 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,2 @@ +# ref: https://github.com/Ezard/semantic-prs +enabled: true \ No newline at end of file diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml new file mode 100644 index 0000000..6f9339f --- /dev/null +++ b/.github/workflows/on-pr.yml @@ -0,0 +1,26 @@ +name: build-packages +on: pull_request +jobs: + connectors-packages: + runs-on: ubuntu-latest + env: + DOTNET_INSTALL_DIR: "/home/runner" + permissions: + contents: write + packages: write + steps: + - name: 'Cleanup build folder' + run: | + rm ./* -r || true + rm ./.??* -r || true + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - run: dotnet build --configuration Release diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml new file mode 100644 index 0000000..a41e722 --- /dev/null +++ b/.github/workflows/on-push.yml @@ -0,0 +1,66 @@ +name: build-packages +on: + push: + branches: + - 'main' +jobs: + connectors-packages: + runs-on: ubuntu-latest + env: + DOTNET_INSTALL_DIR: "/home/runner" + permissions: + contents: write + packages: write + steps: + - name: 'Cleanup build folder' + run: | + rm ./* -r || true + rm ./.??* -r || true + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: gittools/actions/gitversion/setup@v1.1.1 + with: + versionSpec: '5.x' + - uses: gittools/actions/gitversion/execute@v1.1.1 + with: + useConfigFile: true + configFilePath: GitVersion.yml + - name: Tag branch + run: | + git tag $GitVersion_SemVer + git push origin $GitVersion_SemVer + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Authorise NuGet + uses: StirlingLabs/GithubNugetAuthAction@main + with: + owner: data443 + name: Data443 + token: ${{secrets.PACKAGE_TOKEN}} + + - name: Set up GitVersion + uses: gittools/actions/gitversion/setup@v0.9.15 + with: + versionSpec: '5.x' + + - uses: gittools/actions/gitversion/execute@v0.9.15 + with: + useConfigFile: true + configFilePath: GitVersion.yml + + - name: Set Package Version + uses: vers-one/dotnet-project-version-updater@v1.6 + with: + file: "./meilisearch.NET/meilisearch.NET.csproj.csproj" + version: ${{ env.GitVersion_SemVer }} + + - run: dotnet build --configuration Release + - run: dotnet pack ./meilisearch.NET/meilisearch.NET.csproj --output nuget-packages --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + - run: dotnet nuget push **/*.nupkg --skip-duplicate -s "https://nuget.pkg.github.com/data443/index.json" --api-key ${{secrets.GITHUB_TOKEN}} + - run: dotnet nuget remove source Data443 diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..8cbf1d9 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,10 @@ +assembly-versioning-scheme: MajorMinorPatchTag +mode: ContinuousDelivery +branches: {} +ignore: + sha: [] +merge-message-formats: {} + +major-version-bump-message: "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)" +minor-version-bump-message: "^(feat)(\\([\\w\\s-]*\\))?:" +patch-version-bump-message: "^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:" \ No newline at end of file