Repository navigation
134 lines (121 loc) · 3.87 KB
/
Copy pathbuild.yml
File metadata and controls
134 lines (121 loc) · 3.87 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]
env:
app_name: RegexFileSearcher
publish_folder: publish
jobs:
build:
name: ${{ matrix.config.name }} | ${{ matrix.config.build_type }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: Windows,
os: windows-latest,
project: Wpf,
runtime: win-x86,
framework: net5.0-windows,
is_single_file: "false",
build_type: Release
}
- {
name: Linux,
os: ubuntu-latest,
project: Gtk,
runtime: linux-x64,
framework: net5.0,
is_single_file: "true",
build_type: Release
}
- {
name: macOS,
os: macos-latest,
project: Mac,
runtime: osx-x64,
framework: net5.0,
is_single_file: "true",
build_type: Release
}
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: 5.0.x
# This cheap hack is needed because of a build environment "bug": https://github.com/actions/setup-dotnet/issues/155
- name: Clean
run: dotnet clean && dotnet nuget locals all --clear
- name: Publish
run: dotnet publish ${{ env.app_name }}/${{ env.app_name }}.${{ matrix.config.project }}/${{ env.app_name }}.${{ matrix.config.project }}.csproj
--configuration ${{ matrix.config.build_type }}
--output ${{ env.publish_folder }}
--self-contained true
-p:PublishSingleFile=${{ matrix.config.is_single_file }}
--runtime ${{ matrix.config.runtime }}
--framework ${{ matrix.config.framework }}
- name: Create Package
shell: bash
run: |
filename=${{ env.app_name }}-${{ matrix.config.runtime }}
if [[ "${{ runner.os }}" == 'Windows' ]]; then
7z a $filename.zip ./${{ env.publish_folder }}/*
else
zip --junk-paths $filename ./${{ env.publish_folder }}/*
fi
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.config.runtime }} ${{ matrix.config.build_type }}
path: ${{ env.app_name }}-${{ matrix.config.runtime }}.zip
- name: List Build Directory
if: always()
shell: bash
run: |
git status
ls -lR ${{ env.publish_folder }}
upload-packages:
needs: build
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
strategy:
fail-fast: false
matrix:
config:
- {
runtime: win-x86,
build_type: Release
}
- {
runtime: linux-x64,
build_type: Release
}
- {
runtime: osx-x64,
build_type: Release
}
steps:
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ${{ matrix.config.runtime }} ${{ matrix.config.build_type }}
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ env.app_name }}-${{ matrix.config.runtime }}.zip
asset_name: ${{ env.app_name }}-${{ matrix.config.runtime }}.zip
asset_content_type: application/zip