forked from jeremytammik/RevitLookup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
125 lines (118 loc) · 3.89 KB
/
.gitlab-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
115
116
117
118
119
120
121
122
123
124
125
stages:
- download-revit-api
- build
- sign
- publish
download-revit-api:
stage: download-revit-api
image: alpine:3.13
variables:
REVIT_API_URL: https://cdn.bim.ag/revit/2022/RevitAPI.dll
REVIT_API_CHECKSUM: a60011776a7b4994235150ea3ff14929626db97c115ff59ac7524153bb98b48b
REVIT_APIUI_URL: https://cdn.bim.ag/revit/2022/RevitAPIUI.dll
REVIT_APIUI_CHECKSUM: 65ada14a92857debb7ca985a927d75577d1b4bd189fc9d8a061496bd6a19ddbf
GIT_STRATEGY: none
script:
- apk add --update --no-cache curl
- mkdir revit-api
- |
echo "${REVIT_API_CHECKSUM} -" > /tmp/checksum \
&& curl -L "${REVIT_API_URL}" \
| tee revit-api/RevitAPI.dll \
| sha256sum -c /tmp/checksum
- |
echo "${REVIT_APIUI_CHECKSUM} -" > /tmp/checksum \
&& curl -L "${REVIT_APIUI_URL}" \
| tee revit-api/RevitAPIUI.dll \
| sha256sum -c /tmp/checksum
artifacts:
paths:
- revit-api/
expire_in: 1 day
build:
stage: build
tags:
- shared-windows
- windows
- windows-1809
dependencies:
- download-revit-api
variables:
LOOKUP_CONFIGURATION: Release
LOOKUP_SOLUTION: CS/RevitLookup.sln
PATH_BUILD_TOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
DOTNET_CLI_TELEMETRY_OPTOUT: 1
before_script:
- $env:Path += ";${PATH_BUILD_TOOLS}"
- choco install netfx-4.8-devpack -y
script:
- dotnet restore "${LOOKUP_SOLUTION}"
- if (-not $?) { throw "Restore failed" }
# We can't use `dotnet msbuild` here because of some embedded resource issue.
- msbuild -p:Configuration=${LOOKUP_CONFIGURATION} -p:CI=True "${LOOKUP_SOLUTION}"
- if (-not $?) { throw "Build failed" }
- mkdir artifacts
- cp "CS/bin/${LOOKUP_CONFIGURATION}/RevitLookup.dll" artifacts/
- cp "CS/bin/${LOOKUP_CONFIGURATION}/RevitLookup.pdb" artifacts/
- cp "CS/RevitLookup.addin" artifacts/
artifacts:
paths:
- artifacts/
expire_in: 1 day
sign:
stage: sign
image: debian:buster-slim
dependencies:
- build
variables:
ASSEMBLY: artifacts/RevitLookup.dll
TIMESERVER: http://timestamp.digicert.com
DEBIAN_FRONTEND: noninteractive
GIT_STRATEGY: none
script:
- apt-get update && apt-get install -y --no-install-recommends osslsigncode
- mkdir -p .secrets && mount -t ramfs -o size=1M ramfs .secrets/
- echo "${CODESIGN_CERTIFICATE}" | base64 --decode > .secrets/authenticode.spc
- echo "${CODESIGN_KEY}" | base64 --decode > .secrets/authenticode.key
- osslsigncode -h sha1 -spc .secrets/authenticode.spc -key .secrets/authenticode.key -t ${TIMESERVER} -in "${ASSEMBLY}" -out "${ASSEMBLY}-sha1"
- osslsigncode -nest -h sha2 -spc .secrets/authenticode.spc -key .secrets/authenticode.key -t ${TIMESERVER} -in "${ASSEMBLY}-sha1" -out "${ASSEMBLY}"
- rm "${ASSEMBLY}-sha1"
after_script:
- rmdir .secrets
artifacts:
paths:
- artifacts/
expire_in: 1 day
only:
variables:
- $CODESIGN_CERTIFICATE != null
- $CODESIGN_KEY != null
publish:
stage: publish
image: alpine:3.13
dependencies:
- sign
variables:
GIT_STRATEGY: none
before_script:
- |
if [ -n "${CI_COMMIT_TAG}" ]; then
export RELEASE_NAME="${CI_COMMIT_TAG}"
export S3_FOLDER="releases"
else
export RELEASE_NAME="${CI_COMMIT_BRANCH}-$(date --utc -Iseconds)"
export S3_FOLDER="current"
fi
- export ZIP="${RELEASE_NAME}.7z"
- apk add --update --no-cache curl jq py-pip p7zip
- pip install awscli
- eval $(aws ecr get-login --no-include-email --region $AWS_REGION | sed 's|https://||')
script:
- 7z a "${ZIP}" ./artifacts/*
- aws s3 cp "${ZIP}" "s3://${S3_BUCKET_NAME}/${S3_FOLDER}/${ZIP}"
only:
variables:
- $AWS_ACCESS_KEY_ID != null
- $AWS_SECRET_ACCESS_KEY != null
- $AWS_REGION != null
- $S3_BUCKET_NAME != null