Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/scripts/publish-ef.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
set -euxo pipefail

CHANGELOG=$(cat $CHANGELOG_FILE | sed -e '/^## v.*$/,$d')
if [[ -z "$CHANGELOG" ]]
then
echo "CHANGELOG empty"
exit 1;
fi;

LAST_EF_TAG=$(git tag --sort=-creatordate --list 'ef-*' | head -n 1 | cut -d '-' -f 2);
LAST_EF_TAG=${LAST_EF_TAG:-v0.0.0}
MAJOR=$(echo $LAST_EF_TAG | sed -E 's/v([0-9]+)\..*/\1/');
MINOR=$(echo $LAST_EF_TAG | sed -E 's/v[0-9]+\.([0-9]+)\..*/\1/');
PATCH=$(echo $LAST_EF_TAG | sed -E 's/v[0-9]+\.[0-9]+\.([0-9]+)($|-rc[0-9]+)/\1/');
RC=0;

if [ "$RELEASE_CANDIDATE" = true ]
then
RC=$(git tag | grep "ef-v$MAJOR.$MINOR.$PATCH-rc" | wc -l | xargs || true);
fi
if [ "$VERSION_CHANGE" = "MINOR" ] && [ $RC = 0 ]
then
MINOR=$((MINOR+1));
PATCH=0;
fi;
if [ "$VERSION_CHANGE" = "PATCH" ] && [ $RC = 0 ]
then
PATCH=$((PATCH+1));
fi;
if [ "$RELEASE_CANDIDATE" = true ]
then
VERSION="$MAJOR.$MINOR.$PATCH-rc$RC";
else
VERSION="$MAJOR.$MINOR.$PATCH";
fi;

TAG="v$VERSION"
echo -e "## $TAG\n" >> $CHANGELOG_FILE.tmp
cat $CHANGELOG_FILE >> $CHANGELOG_FILE.tmp
mv $CHANGELOG_FILE.tmp $CHANGELOG_FILE;
git add $CHANGELOG_FILE;
git config --global user.email "robot@umbrella";
git config --global user.name "robot";
git commit -m "Release EF $TAG";
git tag "ef-$TAG"
git push --tags && git push
CHANGELOG="$CHANGELOG

Full Changelog: [$LAST_EF_TAG...$TAG](https://github.com/ydb-platform/ydb-dotnet-sdk/compare/$LAST_EF_TAG...$TAG)"

cd src/EFCore.Ydb/src
dotnet pack -c Release -o out /p:Version=$VERSION
gh release create $TAG -t "ef-$TAG" --notes "$CHANGELOG"
dotnet nuget push out/EntityFrameworkCore.Ydb.$VERSION.nupkg --skip-duplicate --api-key $NUGET_TOKEN --source https://api.nuget.org/v3/index.json
3 changes: 0 additions & 3 deletions .github/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ if [ "$RELEASE_CANDIDATE" = true ]
then
VERSION="$MAJOR.$MINOR.$PATCH-rc$RC";
else
sed -e "s/Minor = [0-9]*/Minor = $MINOR/g" -i $VERSION_FILE
sed -e "s/Patch = [0-9]*/Patch = $PATCH/g" -i $VERSION_FILE
git add $VERSION_FILE;
VERSION="$MAJOR.$MINOR.$PATCH";
fi;
TAG="v$VERSION"
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/publish-ef.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: publish
on:
workflow_dispatch:
inputs:
version-change:
description: Version part
required: true
type: choice
options:
- PATCH
- MINOR
release-candidate:
description: Release candidate
required: true
type: boolean
default: True

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
env:
VERSION_CHANGE: ${{ github.event.inputs.version-change }}
RELEASE_CANDIDATE: ${{ github.event.inputs.release-candidate }}
CHANGELOG_FILE: ./src/EFCore.Ydb/CHANGELOG.md
GITHUB_TOKEN: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
NUGET_TOKEN: ${{ secrets.YDB_PLATFORM_NUGET_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: |
cd src/EFCore.Ydb/src
dotnet build --configuration Release
- name: Publish
run: bash .github/scripts/publish-ef.sh

1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
env:
VERSION_CHANGE: ${{ github.event.inputs.version-change }}
RELEASE_CANDIDATE: ${{ github.event.inputs.release-candidate }}
VERSION_FILE: src/Ydb.Sdk/src/Version.cs
CHANGELOG_FILE: CHANGELOG.md
GITHUB_TOKEN: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
NUGET_TOKEN: ${{ secrets.YDB_PLATFORM_NUGET_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion examples/src/EF/EF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>EfCore</RootNamespace>
<RootNamespace>EF</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 0 additions & 8 deletions src/Ydb.Sdk/src/Version.cs

This file was deleted.

Loading