-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
47 lines (37 loc) · 1.6 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
# Set SHELL to 'strict mode' without using .SHELLFLAGS for max compatibility.
# See https://fieldnotes.tech/how-to-shell-for-compatible-makefiles/
SHELL := /usr/bin/env bash -euo pipefail -c
.PHONY: validate test publish publish-dev
CCI_VERSION := $(shell circleci version)
ifeq ($(CCI_VERSION),)
$(error Unable to determine circleci-cli version)
endif
CCI := .make/cci-version-$(CCI_VERSION)
ORB_FILE := orbs/github-status.yml
ORB_NAME := samsalisbury/github-status
ORB_VERSION := $(shell git describe)
ORB_VERSION_DIRTY := $(shell git describe --dirty)
CLEAN := NO
# If these are equal, we are not dirty.
ifeq ($(ORB_VERSION),$(ORB_VERSION_DIRTY))
CLEAN := YES
ORB_EXACT_VERSION := $(shell git describe --exact-match --dirty 2>/dev/null)
endif
# Source contains all input yml files, this Makefile itself
# and the current version of the circleci CLI tool.
SOURCE := Makefile $(CCI) $(shell find . -type f -name '*.yml' -not -path './.circleci/*')
$(CCI):
mkdir -p $(shell dirname $@); touch $@
validate: $(SOURCE)
# Validate the orb itself.
circleci orb validate orbs/github-status.yml
# Check we can pack and process and still have a vaild config.
circleci config pack . | circleci config process - | circleci config validate - > /dev/null
test: validate
# No other tests yet.
publish:
@[ -n "$(ORB_EXACT_VERSION)" ] || { echo "Not on exact annotated git tag, cannot publish."; exit 1; }
circleci orb publish $(ORB_FILE) $(ORB_NAME)@$(ORB_EXACT_VERSION)
publish-dev:
@[ $(CLEAN) = YES ] || { echo "Repo dirty, cannot publish dev version."; exit 1; }
circleci orb publish $(ORB_FILE) $(ORB_NAME)@dev:$(ORB_VERSION)