Skip to content

Commit

Permalink
Merge pull request #40 from dojo90/develop
Browse files Browse the repository at this point in the history
implement git workflow
  • Loading branch information
djonasdev committed Oct 12, 2020
2 parents a5707ff + d563cd1 commit 74bb509
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 11 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Commit
on:
push:
pull_request:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build solution
run: dotnet build -c Release
- name: Fetch nuget packages
run: |
mkdir -p nuget
copy src\NLogViewer\bin\Release\*.nupkg nuget\
- name: Upload nuget packages as artifacts
uses: actions/upload-artifact@v2
with:
name: nupkg
path: nuget
if-no-files-found: error
42 changes: 42 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: publish pre-release
on: [workflow_dispatch]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Build solution
run: dotnet build -c Release
- name: Fetch nuget packages
run: |
mkdir -p nuget
copy src\NLogViewer\bin\Release\*.nupkg nuget\
- name: Upload nuget packages as artifacts
uses: actions/upload-artifact@v2
with:
name: nupkg
path: nuget
if-no-files-found: error

publish:
name: Publish
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download nuget artifacts
uses: actions/download-artifact@v2
with:
name: nupkg
path: nuget
- name: Publish the package to GitHub Packages & nuget.org
run: |
dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --name github --username ${{ github.repository_owner }} --password ${{ github.token }} --store-password-in-clear-text
dotnet nuget push ./nuget/*.nupkg --source github
dotnet nuget push ./nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release
on:
push:
tags:
- '*'
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build solution
run: dotnet build -c Release
- name: Fetch nuget packages
run: |
mkdir -p nuget
copy src\NLogViewer\bin\Release\*.nupkg nuget\
- name: Upload nuget packages as artifacts
uses: actions/upload-artifact@v2
with:
name: nupkg
path: nuget
if-no-files-found: error
publish:
name: Publish
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download nuget artifacts
uses: actions/download-artifact@v2
with:
name: nupkg
path: nuget
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts to release
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const fs = require('fs');
const release_id = '${{ steps.get_release.outputs.id }}';
for (let file of await fs.readdirSync('./nuget')) {
console.log('uploadReleaseAsset', file);
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./nuget/${file}`)
});
}
- name: Publish the package to GitHub Packages & nuget.org
run: |
dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --name github --username ${{ github.repository_owner }} --password ${{ github.token }} --store-password-in-clear-text
dotnet nuget push ./nuget/*.nupkg --source github
dotnet nuget push ./nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
12 changes: 2 additions & 10 deletions src/NLogViewer.sln → NLogViewer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer.TestApp", "NLogViewer.TestApp\NLogViewer.TestApp.csproj", "{FF15C180-042C-42D9-8687-24F1BEB5F4FB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer.TestApp", "src\NLogViewer.TestApp\NLogViewer.TestApp.csproj", "{FF15C180-042C-42D9-8687-24F1BEB5F4FB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer", "NLogViewer\NLogViewer.csproj", "{D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2E975FF9-26E0-49F1-B10A-CFCDE832B0EE}"
ProjectSection(SolutionItems) = preProject
..\Directory.build.props = ..\Directory.build.props
..\GitVersion.yml = ..\GitVersion.yml
..\LICENSE.md = ..\LICENSE.md
..\README.md = ..\README.md
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer", "src\NLogViewer\NLogViewer.csproj", "{D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion src/NLogViewer/NLogViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.1.3">
<PackageReference Include="GitVersionTask" Version="5.3.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 74bb509

Please sign in to comment.