diff --git a/.drone.yml b/.drone.yml index e3c0250..94ba1bf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -183,3 +183,123 @@ steps: depends_on: - dotnet-build - docker +--- +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# 📦 Pipeline 3: Contracts-Only Publish +# Trigger: Tag with commit message containing "contracts_only:" +# Purpose: Fast publish of contract packages without building images +# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +kind: pipeline +type: kubernetes +name: contracts-publish + +metadata: + namespace: musk-drone + +trigger: + ref: + - refs/tags/* + event: + - tag + +clone: + disable: true + +volumes: + - name: nuget-cache + temp: {} + +steps: + - name: clone + image: alpine/git + commands: + - git clone https://gitea.musk.fun/nocr/flea + - cd flea + - git checkout $DRONE_TAG + - git submodule update --init --recursive + + - name: check-trigger + image: alpine/git + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - echo "Commit message - $COMMIT_MSG" + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:"; then + echo "✅ contracts_only detected, proceeding..." + exit 0 + else + echo "⏭️ No contracts_only marker, skipping..." + exit 78 + fi + depends_on: + - clone + + - name: telegram-listener-contracts + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:telegram_listener"; then + echo "📦 Publishing telegram-listener contracts..." + dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + dotnet pack telegram-listener/Nocr.TelegramListener.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + else + echo "⏭️ Skipping telegram-listener contracts" + fi + depends_on: + - check-trigger + + - name: text-matcher-contracts + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:text_matcher"; then + echo "📦 Publishing text-matcher contracts..." + dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + dotnet pack text-matcher/Nocr.TextMatcher.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + else + echo "⏭️ Skipping text-matcher contracts" + fi + depends_on: + - check-trigger + + - name: users-contracts + image: mcr.microsoft.com/dotnet/sdk:8.0 + volumes: + - name: nuget-cache + path: /root/.nuget/packages + environment: + NUGETAPIKEY: + from_secret: nuget_musk_api_key + commands: + - cd flea + - COMMIT_MSG=$(git log -1 --pretty=%B) + - | + if echo "$COMMIT_MSG" | grep -q "contracts_only:users"; then + echo "📦 Publishing users contracts..." + dotnet nuget add source --name musk https://gitea.musk.fun/api/packages/nocr/nuget/index.json + dotnet pack users/Nocr.Users.sln -o ./bin -p:PackageVersion=${DRONE_TAG} + dotnet nuget push ./bin/*Contract*.nupkg --api-key $NUGETAPIKEY --source musk --skip-duplicate + else + echo "⏭️ Skipping users contracts" + fi + depends_on: + - check-trigger