-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Theauxm/feature/actions_release
1.3.0 -- Actions NuGet/Testing
- Loading branch information
Showing
21 changed files
with
251 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"CSharpier": { | ||
"version": "0.26.7", | ||
"commands": [ | ||
"dotnet-csharpier" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Release NuGet Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'Directory.Build.props' | ||
|
||
permissions: | ||
contents: write # Ensure the token has write permissions to contents | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '8.0.204' | ||
|
||
- name: Cache NuGet packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('Directory.Build.props') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Verify version change | ||
id: version | ||
run: | | ||
props_file="Directory.Build.props" | ||
version_line=$(grep '<Version>' $props_file) | ||
new_version=$(echo $version_line | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/') | ||
echo "New version: $new_version" | ||
git fetch --tags | ||
last_tag=$(git tag --sort=-creatordate | head -n 1) | ||
echo "Last tag: $last_tag" | ||
if [ "$new_version" == "${last_tag#v}" ]; then | ||
echo "Version has not changed. Exiting." | ||
exit 0 | ||
fi | ||
echo "Version has changed. Proceeding." | ||
- name: Build project | ||
run: dotnet build --configuration Release | ||
|
||
- name: Pack NuGet package | ||
run: dotnet pack --configuration Release --no-build --output ./nupkgs | ||
|
||
- name: Publish NuGet package | ||
env: | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
run: | | ||
dotnet nuget push ./nupkgs/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json | ||
- name: Create GitHub release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
new_version=$(grep '<Version>' Directory.Build.props | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/') | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git tag v$new_version | ||
git push origin v$new_version | ||
curl -X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases \ | ||
-d '{ | ||
"tag_name": "v'${new_version}'", | ||
"target_commitish": "main", | ||
"name": "v'${new_version}'", | ||
"body": "Release of version '${new_version}'", | ||
"draft": false, | ||
"prerelease": false | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "GraphQL-Client: Run CI/CD Test Suite" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "main" | ||
push: | ||
branches: | ||
- "main" | ||
|
||
# Allow manual runs | ||
workflow_dispatch: ~ | ||
|
||
env: | ||
DOTNET_VERSION: '8.0.204' # The .NET SDK version to use | ||
|
||
jobs: | ||
cleanupcode: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Install tools | ||
run: dotnet tool restore | ||
|
||
- name: Cleanup Code | ||
run: dotnet dotnet-csharpier --check . | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Build Project | ||
run: dotnet build --configuration Release /clp:ErrorsOnly | ||
|
||
- name: Run Tests | ||
run: dotnet test --configuration Release --no-restore /clp:ErrorsOnly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>1.3.0</Version> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# GraphQL-Client | ||
C# GraphQL Client | ||
|
||
[![Build Status](https://github.com/Theauxm/ChainSharp/workflows/Release%20NuGet%20Package/badge.svg)](https://github.com/Theauxm/GraphQL-Client/actions) | ||
[![Test Status](https://github.com/Theauxm/ChainSharp/workflows/ChainSharp:%20Run%20CI/CD%20Test%20Suite/badge.svg)](https://github.com/Theauxm/GraphQL-Client/actions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.