diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 4d6395d..c070b6e 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -1,43 +1,57 @@
-name: .NET
+name: .NET build and test
on:
push:
- branches: [ main ]
+ branches: [ main, automated-nuget.org-publish ]
pull_request:
- branches: [ main ]
+ branches: [ main, automated-nuget.org-publish ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [macos-latest, ubuntu-latest, windows-latest]
+ os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 5.0.x
+ dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- - name: Bump versions
- uses: SiqiLu/dotnet-bump-version@master
- with:
- version_files: "**/*.csproj"
- github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
- run: dotnet test --no-build --verbosity normal
+ run: dotnet test --no-build --verbosity normal --configuration Release
- name: "Build & test"
run: |
echo "done!"
pwd
+
+ deploy:
+ runs-on: ubuntu-latest
+ needs: build
+ if: github.ref == 'refs/heads/master'
+ steps:
+ - uses: actions/checkout@v2
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 6.0.x
+ - name: Restore dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
- name: Publish
run: dotnet publish --configuration Release --no-restore
+ - name: NugetPush
+ run: |
+ ls ./GithubActionsHelloWorld/bin/Release
+ dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.*nupkg --skip-duplicate --include-symbols -p:SymbolPackageFormat=snupkg --api-key ${{secrets.NUGET_TOKEN}} --source https://int.nugettest.org/
- uses: papeloto/action-zip@v1
with:
- files: ./bin/Release/net5.0/win-x64/publish/
+ files: ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
dest: GithubActionsHelloWorld.zip
- uses: "marvinpinto/action-automatic-releases@latest"
with:
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..e7a120f
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,5 @@
+{
+ "recommendations": [
+ "redhat.vscode-yaml"
+ ]
+}
\ No newline at end of file
diff --git a/GithubActionsHelloWorld.csproj b/GithubActionsHelloWorld.csproj
deleted file mode 100644
index cd9b7c7..0000000
--- a/GithubActionsHelloWorld.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Exe
- net5.0
- 1.0.1.7
- 1.0.1.7
- 1.0.1
- 1.0.1
- true
- win-x64
-
-
-
\ No newline at end of file
diff --git a/GithubActionsHelloWorld.sln b/GithubActionsHelloWorld.sln
new file mode 100644
index 0000000..878facb
--- /dev/null
+++ b/GithubActionsHelloWorld.sln
@@ -0,0 +1,36 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GithubActionsHelloWorld", "GithubActionsHelloWorld\GithubActionsHelloWorld.csproj", "{61D51FF5-54B5-4D4D-8374-0476FF605F57}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GithubActionsHelloWorldTests", "GithubActionsHelloWorldTests\GithubActionsHelloWorldTests.csproj", "{1756945F-FE1B-498C-897C-743DD7B791DA}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A0700FEC-48D8-490C-8136-B200F4317767}"
+ ProjectSection(SolutionItems) = preProject
+ .github\workflows\dotnet.yml = .github\workflows\dotnet.yml
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {61D51FF5-54B5-4D4D-8374-0476FF605F57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {61D51FF5-54B5-4D4D-8374-0476FF605F57}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {61D51FF5-54B5-4D4D-8374-0476FF605F57}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {61D51FF5-54B5-4D4D-8374-0476FF605F57}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1756945F-FE1B-498C-897C-743DD7B791DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1756945F-FE1B-498C-897C-743DD7B791DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1756945F-FE1B-498C-897C-743DD7B791DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1756945F-FE1B-498C-897C-743DD7B791DA}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {DF7E6DBA-1CE0-4A5B-932A-0759477DD349}
+ EndGlobalSection
+EndGlobal
diff --git a/GithubActionsHelloWorld/GithubActionsHelloWorld.csproj b/GithubActionsHelloWorld/GithubActionsHelloWorld.csproj
new file mode 100644
index 0000000..75f0ce1
--- /dev/null
+++ b/GithubActionsHelloWorld/GithubActionsHelloWorld.csproj
@@ -0,0 +1,17 @@
+
+
+
+ Exe
+ net6.0
+ 1.0.$(GITHUB_RUN_NUMBER)
+ 0.0.1
+ $(Version)
+ $(Version)
+ $(Version)
+ true
+ true
+ snupkg
+ GithubActionsHelloWorld
+
+
+
\ No newline at end of file
diff --git a/GithubActionsHelloWorld/Program.cs b/GithubActionsHelloWorld/Program.cs
new file mode 100644
index 0000000..4837e2b
--- /dev/null
+++ b/GithubActionsHelloWorld/Program.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Threading.Tasks;
+
+namespace GithubActionsHelloWorld
+{
+ public class Program
+ {
+ public async static Task Main(string[] args)
+ {
+ await Task.Delay(100);
+ Console.WriteLine("Hello World!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/GithubActionsHelloWorldTests/GithubActionsHelloWorldTest.cs b/GithubActionsHelloWorldTests/GithubActionsHelloWorldTest.cs
new file mode 100644
index 0000000..feb6e6d
--- /dev/null
+++ b/GithubActionsHelloWorldTests/GithubActionsHelloWorldTest.cs
@@ -0,0 +1,16 @@
+using GithubActionsHelloWorld;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace GithubActionsHelloWorldTests
+{
+ public class GithubActionsHelloWorldTest
+ {
+ [Fact]
+ public async Task Main_ShouldRunWithoutError()
+ {
+ var args = new string[] { "WrongParameterCount" };
+ await Program.Main(args);
+ }
+ }
+}
\ No newline at end of file
diff --git a/GithubActionsHelloWorldTests/GithubActionsHelloWorldTests.csproj b/GithubActionsHelloWorldTests/GithubActionsHelloWorldTests.csproj
new file mode 100644
index 0000000..1192a42
--- /dev/null
+++ b/GithubActionsHelloWorldTests/GithubActionsHelloWorldTests.csproj
@@ -0,0 +1,26 @@
+
+
+
+ net6.0
+
+ false
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
diff --git a/Program.cs b/Program.cs
deleted file mode 100644
index 36c5793..0000000
--- a/Program.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace GithubActionsHelloWorld
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello World!");
- }
- }
-}