-
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (59 loc) · 2.12 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Create new tag
# git tag v0.0.1
# git push --tags
name: Release on publish
on:
release:
types: [published]
env:
DOTNET_VERSION: '7.0.x'
jobs:
release:
name: Release
strategy:
matrix:
kind: ['linux', 'windows']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
- kind: windows
os: windows-latest
target: win-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="lifelogbb-$tag-${{ matrix.target }}"
# Build everything
dotnet publish --framework net7.0 --runtime "${{ matrix.target }}" -c Release --property:PublishDir="$release_name"
dotnet tool install --global dotnet-ef
# Build migration bundle https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli
if [ "${{ matrix.target }}" == "win-x64" ]; then
dotnet ef migrations bundle -r "${{ matrix.target }}" -p LifelogBb -o "./LifelogBb/$release_name/efbundle.exe"
else
dotnet ef migrations bundle --self-contained -r "${{ matrix.target }}" -p LifelogBb -o "./LifelogBb/$release_name/efbundle"
fi
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
7z a -tzip "$release_name.zip" "./LifelogBb/$release_name/*"
else
tar czvf "$release_name.tar.gz" -C "./LifelogBb/$release_name" .
fi
# Delete output directory
rm -r "./LifelogBb/$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "lifelogbb*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Reference: https://www.newline.co/@krishna/release-management-with-aspnet-core-and-github-actions--ff31a146