This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
forked from segmentio/aws-okta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.release
139 lines (111 loc) · 4.14 KB
/
Makefile.release
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
135
136
137
138
139
# Goals:
# - Linux releases can be published to Github automatically by CircleCI
#
# This Makefile is meant for machines
include Makefile
# set --pre-release if not tagged or tree is dirty or there's a `-` in the tag
ifneq (,$(findstring -,$(VERSION)))
GITHUB_RELEASE_FLAGS := "--pre-release"
PACKAGECLOUD_NAME_SUFFIX := "-prerelease"
endif
PACKAGECLOUD_DEB_DISTROS := \
debian/stretch \
ubuntu/trusty \
ubuntu/xenial \
ubuntu/bionic
PACKAGECLOUD_RPM_DISTROS := \
fedora/27 \
fedora/28
publish: publish-github publish-packagecloud
# note: this doesn't include sha256sums
publish-linux: publish-github-linux publish-packagecloud
publish-github: publish-github-darwin publish-github-linux publish-github-sha256sums
publish-github-darwin: publish-github-darwin-bin
publish-github-linux: publish-github-linux-bin publish-github-deb publish-github-rpm
publish-packagecloud: publish-packagecloud-deb publish-packagecloud-rpm
github-release:
github-release release \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
$(GITHUB_RELEASE_FLAGS) \
--tag $(VERSION) \
--name $(VERSION)
publish-github-darwin-bin: dist/aws-okta-$(VERSION)-darwin-amd64 | github-release
github-release upload \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta-$(VERSION)-darwin-amd64 \
--file $<
publish-github-linux-bin: dist/aws-okta-$(VERSION)-linux-amd64 | github-release
github-release upload \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta-$(VERSION)-linux-amd64 \
--file $<
publish-github-deb: dist/aws-okta_$(VERSION)_amd64.deb | github-release
github-release upload \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta_$(VERSION)_amd64.deb \
--file $<
publish-github-rpm: dist/aws-okta_$(VERSION)_amd64.rpm | github-release
github-release upload \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta_$(VERSION)_amd64.rpm \
--file $<
publish-github-sha256sums: dist/aws-okta-$(VERSION).sha256sums | github-release
github-release upload \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta-$(VERSION).sha256sums \
--file dist/aws-okta-$(VERSION).sha256sums
packagecloud.conf.json:
@echo "{\"url\":\"https://packagecloud.io\",\"token\":\"$${PACKAGECLOUD_TOKEN}\"}" > $@
# package_cloud prints the last 4 chars of our token :(
# so we attempt to filter that out
publish-packagecloud-deb: dist/aws-okta_$(VERSION)_amd64.deb packagecloud.conf.json
@for v in $(PACKAGECLOUD_DEB_DISTROS); do \
package_cloud push --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \
grep -v 'with token:' ; \
done
publish-packagecloud-rpm: dist/aws-okta_$(VERSION)_amd64.rpm packagecloud.conf.json
@for v in $(PACKAGECLOUD_RPM_DISTROS); do \
package_cloud push --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \
grep -v 'with token:' ; \
done
dist: dist-darwin dist-linux dist/aws-okta-$(VERSION).sha256sums
dist-darwin: dist/aws-okta-$(VERSION)-darwin-amd64
dist-linux: dist/aws-okta-$(VERSION)-linux-amd64 dist/aws-okta_$(VERSION)_amd64.deb dist/aws-okta_$(VERSION)_amd64.rpm
dist/aws-okta-$(VERSION).sha256sums: dist/aws-okta-$(VERSION)-darwin-amd64 dist/aws-okta-$(VERSION)-linux-amd64 dist/aws-okta_$(VERSION)_amd64.deb dist/aws-okta_$(VERSION)_amd64.rpm
sha256sum $^ | sed 's|dist/||g' > $@
dist/nfpm-$(VERSION).yaml: | dist/
sed -e "s/\$${VERSION}/$(VERSION)/g" -e "s|\$${DIST_BIN}|dist/aws-okta-$(VERSION)-linux-amd64|g" < nfpm.yaml.tmpl > $@
dist/aws-okta_$(VERSION)_amd64.deb: dist/nfpm-$(VERSION).yaml dist/aws-okta-$(VERSION)-linux-amd64
nfpm -f $< pkg --target $@
dist/aws-okta_$(VERSION)_amd64.rpm: dist/nfpm-$(VERSION).yaml dist/aws-okta-$(VERSION)-linux-amd64
nfpm -f $< pkg --target $@
.PHONY: \
dist \
dist-darwin \
dist-linux \
publish \
publish-github \
publish-github-linux \
publish-github-linux-bin \
publish-github-rpm \
publish-github-deb \
publish-github-darwin \
publish-github-darwin-bin \
github-release