Skip to content

Commit 2852c50

Browse files
authored
Workflow: package and release on tag #8
2 parents 219d308 + 8ed6fb8 commit 2852c50

File tree

2 files changed

+96
-13
lines changed

2 files changed

+96
-13
lines changed

.github/workflows/dotnet-test.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ on:
88

99
jobs:
1010
test:
11-
1211
runs-on: ubuntu-latest
13-
1412
steps:
15-
- uses: actions/checkout@v2
16-
- name: Setup .NET
17-
uses: actions/setup-dotnet@v1
18-
with:
19-
dotnet-version: 5.0.x
20-
- name: Restore dependencies
21-
run: dotnet restore
22-
- name: Build
23-
run: dotnet build --no-restore
24-
- name: Test
25-
run: dotnet test --no-build --verbosity normal
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 5.0.x
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build
25+
run: dotnet build --no-restore
26+
27+
- name: Test
28+
run: dotnet test --no-build --verbosity normal

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish release
2+
3+
on:
4+
push:
5+
tags: [ "v*.*.*" ]
6+
7+
jobs:
8+
package:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
dotnet: [5.0.x]
14+
runtime: [linux-x64, win10-x64, osx.11.0-x64]
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Install tooling
21+
run: sudo apt-get install -qq zip
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v1
25+
with:
26+
dotnet-version: ${{ matrix.dotnet }}
27+
28+
- name: Restore dependencies
29+
run: dotnet restore
30+
31+
- name: Build
32+
run: dotnet build --no-restore
33+
34+
- name: Test
35+
run: dotnet test --no-build --verbosity normal
36+
37+
- name: Publish
38+
run: dotnet publish -r ${{ matrix.runtime }} -c Release -o ./out src/Cli/hashfields.csproj
39+
40+
- name: Make artifact path
41+
id: make-path
42+
env:
43+
ref: ${{ github.ref }}
44+
runtime: ${{ matrix.runtime }}
45+
dotnet: ${{ matrix.dotnet }}
46+
run: |
47+
echo "::set-output name=path::hashfields-${ref/refs\/tags\//}-$runtime-dotnet-$dotnet.zip"
48+
49+
- name: Zip
50+
env:
51+
path: ${{ steps.make-path.outputs.path }}
52+
run: |
53+
zip -r -j $path out/
54+
ls -l $path
55+
56+
- name: Upload artifacts
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: package
60+
path: ${{ steps.make-path.outputs.path }}
61+
62+
release:
63+
runs-on: ubuntu-latest
64+
65+
needs: package
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v2
70+
71+
- name: Download artifacts
72+
uses: actions/download-artifact@v2
73+
with:
74+
name: package
75+
path: ./package
76+
77+
- name: Release
78+
uses: softprops/action-gh-release@v1
79+
with:
80+
files: "./package/*.zip"

0 commit comments

Comments
 (0)