Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/proper versioning #20

Merged
merged 23 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b814763
Add version for nuget
gsilvamartin Feb 29, 2024
fb975ea
Update deploy-algorithms-comparison.yml
gsilvamartin Feb 29, 2024
8648e16
Update deploy-algorithms-graphs.yml
gsilvamartin Feb 29, 2024
1847fc0
Update deploy-algorithms-search.yml
gsilvamartin Feb 29, 2024
f78fd2c
Update deploy-algorithms-sorting.yml
gsilvamartin Feb 29, 2024
683003f
Update deploy-serviceabstractions-mongodb.yml
gsilvamartin Feb 29, 2024
d6e250f
Update deploy-serviceabstractions-redis.yml
gsilvamartin Feb 29, 2024
4f13c6f
Update deploy-serviceabstractions-mongodb.yml
gsilvamartin Feb 29, 2024
d5550fd
Update deploy-algorithms-sorting.yml
gsilvamartin Feb 29, 2024
2359768
Update deploy-algorithms-search.yml
gsilvamartin Feb 29, 2024
d813d48
Update deploy-algorithms-graphs.yml
gsilvamartin Feb 29, 2024
ee984d1
Update deploy-algorithms-comparison.yml
gsilvamartin Feb 29, 2024
1833e59
Update deploy-algorithms-comparison.yml
gsilvamartin Feb 29, 2024
f1e95f0
Update deploy-algorithms-graphs.yml
gsilvamartin Feb 29, 2024
b15aa3e
Update deploy-algorithms-search.yml
gsilvamartin Feb 29, 2024
0e77567
Update deploy-algorithms-graphs.yml
gsilvamartin Feb 29, 2024
4eda253
Update deploy-algorithms-comparison.yml
gsilvamartin Feb 29, 2024
6ee6943
Update deploy-algorithms-sorting.yml
gsilvamartin Feb 29, 2024
34590ec
Update deploy-serviceabstractions-mongodb.yml
gsilvamartin Feb 29, 2024
44ba6d6
Update deploy-serviceabstractions-redis.yml
gsilvamartin Feb 29, 2024
0186501
Update dotnet-test.yml
gsilvamartin Feb 29, 2024
304bad7
Update build-documentation.yml
gsilvamartin Feb 29, 2024
c85239d
Update codeql.yml
gsilvamartin Feb 29, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Validate NetPlus Documentation

on:
pull_request:
branches: [ "main" ]
branches: [ "main", "release/*" ]

permissions:
actions: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ name: "CodeQL Code Quality Check"

on:
push:
branches: [ "main", "main-lock" ]
branches: [ "main", "main-lock", "release/*" ]
pull_request:
branches: [ "main", "main-lock" ]
branches: [ "main", "main-lock", "release/*" ]

jobs:
analyze:
Expand Down
56 changes: 12 additions & 44 deletions .github/workflows/deploy-algorithms-comparison.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,41 @@
name: Publish - NetPlus.Algorithms.Comparison

on:
push:
release:
types:
- created
branches:
- main
- 'release/*'

jobs:
build-and-push-algorithms-comparison:
runs-on: ubuntu-latest

outputs:
package_version: ${{ steps.pack.outputs.package_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .NET
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0"

- name: Get latest NuGet package version
id: get-latest-version
run: |
nuget_response=$(curl -s "https://api.nuget.org/v3-flatcontainer/NetPlus.Algorithms.Comparison/index.json")
echo "NuGet API Response:"
echo "$nuget_response"

if [[ $nuget_response == *"The specified blob does not exist."* ]]; then
echo "NuGet API response is empty. Setting version to 1.0.0"
echo "NEW_VERSION=1.0.0" >> $GITHUB_ENV
else
latest_version=$(echo "$nuget_response" | python -c "import sys, json; data = json.load(sys.stdin); versions = data.get('versions', []); versions = [v for v in versions if v is not None]; print(max(versions, key=lambda s: list(map(int, s.split('.')))) if versions else '')")

echo "Latest version after parsing:"
echo "$latest_version"

if [ -z "$latest_version" ]; then
echo "No versions found or latest version is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
elif [ "$latest_version" = "1.0.0" ]; then
echo "NuGet API response is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
else
IFS='.' read -r -a version_parts <<< "$latest_version"
((version_parts[2]++))
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
echo "Latest version: $latest_version"
echo "New version: $new_version"
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
fi
fi

- name: Show environment variable
run: |
echo "NEW_VERSION: $NEW_VERSION"

- name: Install nuget CLI
run: |
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
alias nuget="mono /usr/local/bin/nuget.exe"

- name: Get tag name
id: get_tag
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV

- name: Build Project and Pack NuGet package
run: dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Comparison/NetPlus.Algorithms.Comparison.csproj --configuration Release --output nupkg -p:PackageVersion=$NEW_VERSION
run: |
dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Comparison/NetPlus.Algorithms.Comparison.csproj --configuration Release --output nupkg /p:PackageVersion=$TAG_NAME

- name: Push NuGet Package
run: |
nupkg_path="nupkg/NetPlus.Algorithms.Comparison.$NEW_VERSION.nupkg"
nupkg_path="*/*.nupkg"
nuget push $nupkg_path -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
56 changes: 12 additions & 44 deletions .github/workflows/deploy-algorithms-graphs.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,41 @@
name: Publish - NetPlus.Algorithms.Graphs

on:
push:
release:
types:
- created
branches:
- main
- 'release/*'

jobs:
build-and-push-algorithms-graph:
runs-on: ubuntu-latest

outputs:
package_version: ${{ steps.pack.outputs.package_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .NET
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0'

- name: Get latest NuGet package version
id: get-latest-version
run: |
nuget_response=$(curl -s "https://api.nuget.org/v3-flatcontainer/NetPlus.Algorithms.Graphs/index.json")
echo "NuGet API Response:"
echo "$nuget_response"

if [[ $nuget_response == *"The specified blob does not exist."* ]]; then
echo "NuGet API response is empty. Setting version to 1.0.0"
echo "NEW_VERSION=1.0.0" >> $GITHUB_ENV
else
latest_version=$(echo "$nuget_response" | python -c "import sys, json; data = json.load(sys.stdin); versions = data.get('versions', []); versions = [v for v in versions if v is not None]; print(max(versions, key=lambda s: list(map(int, s.split('.')))) if versions else '')")

echo "Latest version after parsing:"
echo "$latest_version"

if [ -z "$latest_version" ]; then
echo "No versions found or latest version is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
elif [ "$latest_version" = "1.0.0" ]; then
echo "NuGet API response is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
else
IFS='.' read -r -a version_parts <<< "$latest_version"
((version_parts[2]++))
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
echo "Latest version: $latest_version"
echo "New version: $new_version"
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
fi
fi

- name: Show environment variable
run: |
echo "NEW_VERSION: $NEW_VERSION"

- name: Install nuget CLI
run: |
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
alias nuget="mono /usr/local/bin/nuget.exe"

- name: Get tag name
id: get_tag
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV

- name: Build Project and Pack NuGet package
run: dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Graphs/NetPlus.Algorithms.Graphs.csproj --configuration Release --output nupkg -p:PackageVersion=$NEW_VERSION
run: |
dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Graphs/NetPlus.Algorithms.Graphs.csproj --configuration Release --output nupkg /p:PackageVersion=$TAG_NAME

- name: Push NuGet Package
run: |
nupkg_path="nupkg/NetPlus.Algorithms.Graphs.$NEW_VERSION.nupkg"
nupkg_path="*/*.nupkg"
nuget push $nupkg_path -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
56 changes: 12 additions & 44 deletions .github/workflows/deploy-algorithms-search.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,41 @@
name: Publish - NetPlus.Algorithms.Search

on:
push:
release:
types:
- created
branches:
- main
- 'release/*'

jobs:
build-and-push-algorithms-search:
runs-on: ubuntu-latest

outputs:
package_version: ${{ steps.pack.outputs.package_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .NET
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0'

- name: Get latest NuGet package version
id: get-latest-version
run: |
nuget_response=$(curl -s "https://api.nuget.org/v3-flatcontainer/NetPlus.Algorithms.Search/index.json")
echo "NuGet API Response:"
echo "$nuget_response"

if [[ $nuget_response == *"The specified blob does not exist."* ]]; then
echo "NuGet API response is empty. Setting version to 1.0.0"
echo "NEW_VERSION=1.0.0" >> $GITHUB_ENV
else
latest_version=$(echo "$nuget_response" | python -c "import sys, json; data = json.load(sys.stdin); versions = data.get('versions', []); versions = [v for v in versions if v is not None]; print(max(versions, key=lambda s: list(map(int, s.split('.')))) if versions else '')")

echo "Latest version after parsing:"
echo "$latest_version"

if [ -z "$latest_version" ]; then
echo "No versions found or latest version is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
elif [ "$latest_version" = "1.0.0" ]; then
echo "NuGet API response is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
else
IFS='.' read -r -a version_parts <<< "$latest_version"
((version_parts[2]++))
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
echo "Latest version: $latest_version"
echo "New version: $new_version"
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
fi
fi

- name: Show environment variable
run: |
echo "NEW_VERSION: $NEW_VERSION"

- name: Install nuget CLI
run: |
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
alias nuget="mono /usr/local/bin/nuget.exe"

- name: Get tag name
id: get_tag
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV

- name: Build Project and Pack NuGet package
run: dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Search/NetPlus.Algorithms.Search.csproj --configuration Release --output nupkg -p:PackageVersion=$NEW_VERSION
run: |
dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Search/NetPlus.Algorithms.Search.csproj --configuration Release --output nupkg /p:PackageVersion=$TAG_NAME

- name: Push NuGet Package
run: |
nupkg_path="nupkg/NetPlus.Algorithms.Search.$NEW_VERSION.nupkg"
nupkg_path="*/*.nupkg"
nuget push $nupkg_path -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
54 changes: 11 additions & 43 deletions .github/workflows/deploy-algorithms-sorting.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: Publish - NetPlus.Algorithms.Sorting

on:
push:
release:
types:
- created
branches:
- main
- 'release/*'

jobs:
build-and-push-algorithms-sorting:
runs-on: ubuntu-latest

outputs:
package_version: ${{ steps.pack.outputs.package_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -21,53 +20,22 @@ jobs:
with:
dotnet-version: '8.0'

- name: Get latest NuGet package version
id: get-latest-version
run: |
nuget_response=$(curl -s "https://api.nuget.org/v3-flatcontainer/NetPlus.Algorithms.Sorting/index.json")
echo "NuGet API Response:"
echo "$nuget_response"

if [[ $nuget_response == *"The specified blob does not exist."* ]]; then
echo "NuGet API response is empty. Setting version to 1.0.0"
echo "NEW_VERSION=1.0.0" >> $GITHUB_ENV
else
latest_version=$(echo "$nuget_response" | python -c "import sys, json; data = json.load(sys.stdin); versions = data.get('versions', []); versions = [v for v in versions if v is not None]; print(max(versions, key=lambda s: list(map(int, s.split('.')))) if versions else '')")

echo "Latest version after parsing:"
echo "$latest_version"

if [ -z "$latest_version" ]; then
echo "No versions found or latest version is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
elif [ "$latest_version" = "1.0.0" ]; then
echo "NuGet API response is 1.0.0. Setting version to 1.0.1"
echo "NEW_VERSION=1.0.1" >> $GITHUB_ENV
else
IFS='.' read -r -a version_parts <<< "$latest_version"
((version_parts[2]++))
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
echo "Latest version: $latest_version"
echo "New version: $new_version"
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
fi
fi

- name: Show environment variable
run: |
echo "NEW_VERSION: $NEW_VERSION"

- name: Install nuget CLI
run: |
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
alias nuget="mono /usr/local/bin/nuget.exe"

- name: Get tag name
id: get_tag
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV

- name: Build Project and Pack NuGet package
run: dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Sorting/NetPlus.Algorithms.Sorting.csproj --configuration Release --output nupkg -p:PackageVersion=$NEW_VERSION
run: |
dotnet pack src/NetPlus.Algorithms/NetPlus.Algorithms.Sorting/NetPlus.Algorithms.Sorting.csproj --configuration Release --output nupkg /p:PackageVersion=$TAG_NAME

- name: Push NuGet Package
run: |
nupkg_path="nupkg/NetPlus.Algorithms.Sorting.$NEW_VERSION.nupkg"
nupkg_path="*/*.nupkg"
nuget push $nupkg_path -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
Loading
Loading