-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
52 lines (47 loc) · 1.55 KB
/
Makefile
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
BUILD_DIR:=src/TalonOne
VERSION:=$(shell grep -om1 -E '^\[assembly: AssemblyVersion\("[0-9\.]+"\)\]$$' $(PWD)/$(BUILD_DIR)/Properties/AssemblyInfo.cs | sed 's/\[assembly: AssemblyVersion("\(.*\)")\]/\1/')
DOCKER_TAG_ARCH:=$(shell [[ $(shell uname -m) == "arm64" ]] && echo "8.0-focal-arm64v8" || echo "sdk:8.0-focal")
default: testenv
clean:
rm -rf $(PWD)/$(BUILD_DIR)/TalonOne.$(VERSION)*.nupkg && \
rm -rf $(PWD)/$(BUILD_DIR)/TalonOne.$(VERSION).snupkg
pack: clean
ifeq ($(VERSION),)
@echo "***\033[0;31mERROR:\033[0m NO VERSION COULD BE EXTRACTED. Check out the AssemblyInfo.cs file"
@exit 1
endif
docker run \
--rm \
-v $(PWD):/tmp/talon-client \
-w "/tmp/talon-client/$(BUILD_DIR)" \
mcr.microsoft.com/dotnet/sdk:$(DOCKER_TAG_ARCH) \
dotnet pack TalonOne.csproj \
-p:PackageVersion=$(VERSION) \
--output . \
--configuration Release \
--include-source
publish: pack
ifeq ($(VERSION),)
@echo "***\033[0;31mERROR:\033[0m NO VERSION COULD BE EXTRACTED. Check out the AssemblyInfo.cs file"
@exit 1
endif
ifeq ($(apiKey),)
@echo "***\033[0;31mERROR:\033[0m NO apiKey WAS NOT PROVIDED."
@exit 1
endif
docker run \
--rm \
-v $(PWD):/tmp/talon-client \
-w "/tmp/talon-client/$(BUILD_DIR)" \
mcr.microsoft.com/dotnet/sdk:$(DOCKER_TAG_ARCH) \
dotnet nuget push TalonOne.$(VERSION).nupkg \
--api-key $(apiKey) \
--source https://api.nuget.org/v3/index.json
.PHONY: testenv
testenv:
docker run \
--rm -it \
-v $(PWD):/tmp/talon-client \
-w /tmp/talon-client \
mcr.microsoft.com/dotnet/sdk:$(DOCKER_TAG_ARCH) \
/bin/bash