Skip to content

Commit 10d187f

Browse files
committed
Add GitHub action to build release archive
1 parent 65394fe commit 10d187f

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/build.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
release:
8+
name: Release
9+
strategy:
10+
matrix:
11+
kind: ['linux', 'windows', 'macOS']
12+
include:
13+
- kind: linux
14+
os: ubuntu-latest
15+
target: linux-x64
16+
- kind: windows
17+
os: windows-latest
18+
target: win-x64
19+
- kind: macOS
20+
os: macos-latest
21+
target: osx-x64
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Setup dotnet
29+
uses: actions/setup-dotnet@v1
30+
with:
31+
dotnet-version: 5.0.100
32+
33+
- name: Build
34+
shell: bash
35+
run: |
36+
tag=$(git describe --tags --abbrev=0)
37+
release_name="Nullforce.StreamTools.ImageScroller-$tag-${{ matrix.target }}"
38+
# Build everything
39+
dotnet publish src/Nullforce.StreamTools.ImageScroller/Nullforce.StreamTools.ImageScroller.csproj --framework net5.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name"
40+
cp LICENSE "$release_name"
41+
cp README.md "$release_name"
42+
# Pack files
43+
if [ "${{ matrix.target }}" == "win-x64" ]; then
44+
# Pack to zip for Windows
45+
7z a -tzip "${release_name}.zip" "./${release_name}/*"
46+
else
47+
tar czvf "${release_name}.tar.gz" "$release_name"
48+
fi
49+
# Delete output directory
50+
rm -r "$release_name"
51+
- name: Publish
52+
uses: softprops/action-gh-release@v1
53+
with:
54+
files: "Nullforce.StreamTools.ImageScroller*"
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)