Skip to content

Commit d00b5f7

Browse files
committed
add gh actions(#7)
1 parent 9c7627e commit d00b5f7

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: .NET Core Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
include:
11+
- os: "windows-latest"
12+
rid: "win-x64"
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup .NET Core 8.0
16+
uses: actions/setup-dotnet@v3
17+
with:
18+
dotnet-version: "8.0.300"
19+
- name: archiving dotnet tool
20+
run: "powershell ./build.ps1 --target Archive --configuration Release --runtime \"${{matrix.rid}}\""
21+
- name: upload artifacts
22+
uses: actions/upload-artifact@v1
23+
with:
24+
name: "WEventViewer-win-x64"
25+
path: "dist/publish/Release/${{matrix.rid}}/WEventViewer-${{matrix.rid}}.zip"
26+
release:
27+
runs-on: "windows-latest"
28+
needs: ["build"]
29+
if: startsWith(github.ref, 'refs/tags/')
30+
steps:
31+
- uses: actions/checkout@v1
32+
- name: Setup .NET Core
33+
uses: actions/setup-dotnet@v3
34+
with:
35+
dotnet-version: |
36+
8.0.100
37+
- name: restore dotnet tools
38+
run: dotnet tool restore
39+
- name: downloading nuget package
40+
uses: actions/download-artifact@v1
41+
with:
42+
name: "nupkg-win-x64"
43+
path: nupkg
44+
- name: downloading win-x64 binary
45+
uses: actions/download-artifact@v1
46+
with:
47+
name: "bin-win-x64"
48+
path: win-x64
49+
- name: downloading osx-x64 binary
50+
uses: actions/download-artifact@v1
51+
with:
52+
name: "bin-osx-x64"
53+
path: osx-x64
54+
- name: downloading linux-x64 binary
55+
uses: actions/download-artifact@v1
56+
with:
57+
name: "bin-linux-x64"
58+
path: linux-x64
59+
- name: create github release
60+
uses: actions/create-release@v1
61+
id: create_release
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
tag_name: ${{github.ref}}
66+
draft: true
67+
prerelease: false
68+
release_name: "Release ${{github.ref}}"
69+
- name: extract tag name
70+
uses: frabert/replace-string-action@v1
71+
with:
72+
pattern: "refs/tags/"
73+
string: ${{github.ref}}
74+
replace-with: ""
75+
id: extract_tag_name
76+
- name: publish nupkg as github release assets
77+
uses: actions/[email protected]
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
upload_url: ${{steps.create_release.outputs.upload_url}}
82+
asset_path: nupkg/dotnet-compressor.${{ steps.extract_tag_name.outputs.replaced }}.nupkg
83+
asset_name: dotnet-compressor.${{ steps.extract_tag_name.outputs.replaced }}.nupkg
84+
asset_content_type: application/zip
85+
- name: publish snupkg as github release assets
86+
uses: actions/[email protected]
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
upload_url: ${{steps.create_release.outputs.upload_url}}
91+
asset_path: nupkg/dotnet-compressor.${{ steps.extract_tag_name.outputs.replaced }}.snupkg
92+
asset_name: dotnet-compressor.${{ steps.extract_tag_name.outputs.replaced }}.snupkg
93+
asset_content_type: application/zip
94+
- name: publish macos binary as github release assets
95+
uses: actions/[email protected]
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
with:
99+
upload_url: ${{steps.create_release.outputs.upload_url}}
100+
asset_path: osx-x64/dcomp
101+
asset_name: dcomp-osx-x64
102+
asset_content_type: application/octet-binary
103+
- name: publish linux binary as github release assets
104+
uses: actions/[email protected]
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
upload_url: ${{steps.create_release.outputs.upload_url}}
109+
asset_path: linux-x64/dcomp
110+
asset_name: dcomp-linux-x64
111+
asset_content_type: application/octet-binary
112+
- name: publish windows binary as github release assets
113+
uses: actions/[email protected]
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
with:
117+
upload_url: ${{steps.create_release.outputs.upload_url}}
118+
asset_path: win-x64/dcomp.exe
119+
asset_name: dcomp-win-x64.exe
120+
asset_content_type: application/octet-binary
121+
- name: publish windows binary pdb as github release assets
122+
uses: actions/[email protected]
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
with:
126+
upload_url: ${{steps.create_release.outputs.upload_url}}
127+
asset_path: win-x64/dcomp.pdb
128+
asset_name: dcomp-win-x64.pdb
129+
asset_content_type: application/octet-binary
130+
- name: upload nupkg to nugetorg
131+
run: "dotnet nuget push -k \"${{secrets.NUGET_API_KEY}}\" -s https://api.nuget.org/v3/index.json nupkg/dotnet-compressor.${{ steps.extract_tag_name.outputs.replaced }}.nupkg"

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
release:
3+
types:
4+
- published
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
include:
11+
- os: "windows-latest"
12+
rid: "win-x64"
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup .NET Core 8.0
16+
uses: actions/setup-dotnet@v3
17+
with:
18+
dotnet-version: "8.0.300"
19+
- name: archiving dotnet tool
20+
run: "powershell ./build.ps1 --target Archive --configuration Release --runtime \"${{matrix.rid}}\""
21+
- name: upload artifacts
22+
uses: actions/upload-artifact@v1
23+
with:
24+
name: "WEventViewer-win-x64"
25+
path: "dist/publish/Release/${{matrix.rid}}/WEventViewer-${{matrix.rid}}.zip"
26+
release:
27+
needs: build
28+
runs-on: "windows-latest"
29+
steps:
30+
- name: download WEventViewer.zip
31+
uses: actions/download-artifact@v3
32+
with:
33+
path: artifacts
34+
- name: upload zip to gh release
35+
run: gh release upload ${{github.event.release.tag_name}} artifacts/WEventViewer-win-x64/WEventViewer-win-x64.zip
36+
env:
37+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)