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
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [ master, feature/** ]
pull_request:
branches: [ master ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
10.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build src/MaskedUUID.AspNetCore/MaskedUUID.AspNetCore.csproj --configuration Release --no-restore

- name: Build Tests
run: dotnet build tests/MaskedUUID.AspNetCore.Tests/MaskedUUID.AspNetCore.Tests.csproj --configuration Release --no-restore

- name: Test
run: dotnet test tests/MaskedUUID.AspNetCore.Tests/MaskedUUID.AspNetCore.Tests.csproj --configuration Release --no-build --verbosity normal
84 changes: 84 additions & 0 deletions .github/workflows/nuget-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Publish to NuGet

on:
push:
branches: [ release ]
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # タグ取得用

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
10.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build src/MaskedUUID.AspNetCore/MaskedUUID.AspNetCore.csproj --configuration Release --no-restore

- name: Build Tests
run: dotnet build tests/MaskedUUID.AspNetCore.Tests/MaskedUUID.AspNetCore.Tests.csproj --configuration Release --no-restore

- name: Test
run: dotnet test tests/MaskedUUID.AspNetCore.Tests/MaskedUUID.AspNetCore.Tests.csproj --configuration Release --no-build --verbosity normal

- name: Calculate Version
id: version
run: |
# csprojからVersionPrefixを取得
VERSION_PREFIX=$(grep -oP '(?<=<VersionPrefix>)[^<]+' src/MaskedUUID.AspNetCore/MaskedUUID.AspNetCore.csproj)
echo "VersionPrefix: $VERSION_PREFIX"

# 前回のタグを取得
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")

if [ -z "$PREV_TAG" ]; then
# タグがない場合は初回リリース
VERSION="${VERSION_PREFIX}.0"
else
# 前回タグからx.yを抽出
PREV_XY=$(echo $PREV_TAG | sed 's/^v//' | cut -d. -f1,2)
PREV_Z=$(echo $PREV_TAG | sed 's/^v//' | cut -d. -f3)

if [ "$PREV_XY" = "$VERSION_PREFIX" ]; then
# 同じx.yならzをインクリメント
NEW_Z=$((PREV_Z + 1))
VERSION="${VERSION_PREFIX}.${NEW_Z}"
else
# 異なるx.yならz=0
VERSION="${VERSION_PREFIX}.0"
fi
fi

echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Package Version: $VERSION"

- name: Pack
run: dotnet pack src/MaskedUUID.AspNetCore/MaskedUUID.AspNetCore.csproj
--configuration Release
--output ./nupkg
/p:PackageVersion=${{ steps.version.outputs.version }}

- name: Publish to NuGet
run: dotnet nuget push ./nupkg/*.nupkg
--api-key ${{ secrets.NUGET_API_KEY }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate

- name: Create Git Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag v${{ steps.version.outputs.version }}
git push origin v${{ steps.version.outputs.version }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 actbit

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.
16 changes: 16 additions & 0 deletions src/MaskedUUID.AspNetCore/MaskedUUID.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>

<!-- NuGet Package Settings -->
<PackageId>MaskedUUID.AspNetCore</PackageId>
<VersionPrefix>1.0</VersionPrefix>
<Authors>actbit</Authors>
<Description>ASP.NET Core で UUIDv7 のタイムスタンプ部を UUIDv47 アルゴリズムでマスクし、可逆的に変換するライブラリ</Description>
<PackageTags>uuid;uuidv7;uuidv47;aspnetcore;masking</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/actbit/MaskedUUID</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>