-
Notifications
You must be signed in to change notification settings - Fork 6
114 lines (103 loc) · 2.87 KB
/
ci.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
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
name: ci
on:
workflow_dispatch:
push:
branches:
- "**"
paths:
- ".github/workflows/ci.yml"
- "src/**"
- "*.sln"
- "*.props"
tags:
- "v*"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/ci.yml"
- "src/**"
- "*.sln"
- "*.props"
jobs:
meta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: meta
shell: bash
run: |
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
tag=$(git describe --tags --match "v*" ${{ github.ref }} || true)
if ! $($is_release) ; then
prefix=${tag%-*-*}
suffix=${tag#$prefix-}
tag="$prefix-Preview.$suffix"
fi
echo tag=$tag | tee -a $GITHUB_OUTPUT
echo version=${tag#v} | tee -a $GITHUB_OUTPUT
echo is_release=$is_release | tee -a $GITHUB_OUTPUT
outputs:
tag: ${{ steps.meta.outputs.tag }}
version: ${{ steps.meta.outputs.version }}
is_release: ${{ steps.meta.outputs.is_release }}
publish:
needs: [meta]
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
arch: [aarch64, x86_64]
dotnet: [ '7.0' ]
fail-fast: false
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet }}
cache: true
cache-dependency-path: '**/packages.lock.json'
- run: dotnet restore --locked-mode
- name: Build
id: build
shell: bash
run: |
dotnet publish\
--configuration Release \
--no-restore \
-p:Version=${{ needs.meta.outputs.version }} \
-p:OnPublishing=true
RID=$(ls ./src/MBA.Cli/bin/Release/net${{ matrix.dotnet }}/)
echo RID=$RID | tee -a $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: always()
with:
name: MBA-${{ steps.build.outputs.RID }}
path: "src/MBA.Cli/bin/Release/net${{ matrix.dotnet }}/${{ steps.build.outputs.RID }}/publish"
release:
#if: ${{ needs.meta.outputs.is_release == 'true' }}
needs: [meta, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: assets
- run: |
cd assets
ls -al
for f in *; do
ls -al
(cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .)
done
- uses: softprops/action-gh-release@v1
if: false
with:
files: assets/*.zip
tag_name: ${{ needs.meta.outputs.tag }}