-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (95 loc) · 3.86 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
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
# Builds and releases a new public version of C# evitaDB driver a puts it into `Releases` section of GitHub
name: Release
on:
workflow_dispatch:
push:
branches: ["master"]
permissions:
contents: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-and-release:
name: Build and release
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout sources
timeout-minutes: 60 # Set the timeout to 60 minutes for this job
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.X' # setup dotnet 7
- name: Restore solution
run: dotnet restore ./EvitaDB.sln
- name: Build solution
run: dotnet build ./EvitaDB.sln --configuration Release --no-restore
- name: Run tests
run: dotnet test ./EvitaDB.sln --configuration Release --no-build
- name: Resolve new release version
id: release_version
uses: codacy/[email protected]
with:
prefix: 'v'
minor-identifier: 'feat:'
major-identifier: '(breaking)' # this should be placed somewhere in the commit message like "feat: (breaking) some message"
- name: Build query validator
run: |
cd EvitaDB.QueryValidator
dotnet publish -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained false --no-build
dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained false --no-build
- name: Zip
uses: vimtor/action-zip@v1
with:
dest: 'Validator.zip'
files: 'EvitaDB.QueryValidator/bin/Release/net7.0/linux-x64/publish/Validator'
recursive: true
- name: Zip
uses: vimtor/action-zip@v1
with:
dest: 'Validator-win.zip'
files: 'EvitaDB.QueryValidator/bin/Release/net7.0/win-x64/publish/Validator.exe'
recursive: true
- name: Pack nuget
env:
NUGET_VERSION: $( echo ${{ steps.release_version.outputs.version }} | sed 's/^v//')
run: |
export CURRENT_VERSION="${{ steps.release_version.outputs.version }}"
export NEW_VERSION="$( echo ${CURRENT_VERSION} | sed 's/^v//')"
cd EvitaDB.Client
dotnet pack -c Release -p:PackageVersion="${NEW_VERSION}" --no-build --no-restore
- name: Create release
id: create_release
uses: release-drafter/release-drafter@v5
with:
version: ${{ steps.release_version.outputs.version }}
publish: true
- name: Upload Validator.zip to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Validator.zip
asset_name: Validator.zip
asset_content_type: application/zip
- name: Upload Validator-win.zip to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Validator-win.zip
asset_name: Validator-win.zip
asset_content_type: application/gzip
- name: Publish nuget
run: |
export CURRENT_VERSION="${{ steps.release_version.outputs.version }}"
export NEW_VERSION="$( echo ${CURRENT_VERSION} | sed 's/^v//')"
cd EvitaDB.Client/bin/Release
dotnet nuget push EvitaDB.Client."${NEW_VERSION}".nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json