mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-06 10:19:38 +00:00
chore(make): refactoring of the distribution task
This commit is contained in:
parent
5c01d87aa3
commit
7cb6140c1b
|
@ -9,10 +9,10 @@ deploy:
|
|||
api_key:
|
||||
secure: VATbHmgR1DDXlIHEMpupuTggPU6wgtZk3BFK/eT5L+qqhnfSal1z+ZsypgWMGZN2Ch6WTRFaXqUhpV7N2oo+pQoXAYcDFWTd3BiTUied+pKVoUa8VuZFF2TW1cNcVJ3fnFPMFnpJPTYkld//+8s8zJQitTabE1QZdXNYPU1uUiY=
|
||||
file:
|
||||
- release/webhookd-linux-amd64.gz
|
||||
- release/webhookd-linux-arm64.gz
|
||||
- release/webhookd-linux-arm.gz
|
||||
- release/webhookd-darwin-amd64.gz
|
||||
- release/webhookd-linux-amd64.tgz
|
||||
- release/webhookd-linux-arm64.tgz
|
||||
- release/webhookd-linux-arm.tgz
|
||||
- release/webhookd-darwin-amd64.tgz
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: ncarlier/webhookd
|
||||
|
|
|
@ -39,7 +39,7 @@ RUN apk add --no-cache git openssh-client jq bash
|
|||
RUN mkdir -p /var/opt/webhookd/scripts /var/opt/webhookd/work
|
||||
|
||||
# Install binary and default scripts
|
||||
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/release/$ARTIFACT-linux-amd64 /usr/local/bin/$ARTIFACT
|
||||
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/release/$ARTIFACT /usr/local/bin/$ARTIFACT
|
||||
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/scripts /var/opt/webhookd/scripts
|
||||
COPY docker-entrypoint.sh /
|
||||
|
||||
|
|
41
Makefile
41
Makefile
|
@ -13,8 +13,11 @@ GOARCH?=amd64
|
|||
is_windows:=$(filter windows,$(GOOS))
|
||||
EXT:=$(if $(is_windows),".exe","")
|
||||
|
||||
# Artefact name
|
||||
ARTEFACT=release/$(APPNAME)-$(GOOS)-$(GOARCH)$(EXT)
|
||||
# Archive name
|
||||
ARCHIVE=$(APPNAME)-$(GOOS)-$(GOARCH).tgz
|
||||
|
||||
# Executable name
|
||||
EXECUTABLE=$(APPNAME)$(EXT)
|
||||
|
||||
# Extract version infos
|
||||
VERSION:=`git describe --tags`
|
||||
|
@ -35,11 +38,11 @@ clean:
|
|||
## Build executable
|
||||
build:
|
||||
-mkdir -p release
|
||||
echo "Building: $(ARTEFACT) $(VERSION) ..."
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(LDFLAGS) -o $(ARTEFACT)
|
||||
echo "Building: $(EXECUTABLE) $(VERSION) for $(GOOS)-$(GOARCH) ..."
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(LDFLAGS) -o release/$(EXECUTABLE)
|
||||
.PHONY: build
|
||||
|
||||
$(ARTEFACT): build
|
||||
release/$(EXECUTABLE): build
|
||||
|
||||
## Run tests
|
||||
test:
|
||||
|
@ -47,14 +50,14 @@ test:
|
|||
.PHONY: test
|
||||
|
||||
## Install executable
|
||||
install: $(ARTEFACT)
|
||||
echo "Installing $(ARTEFACT) to ${HOME}/.local/bin/$(APPNAME) ..."
|
||||
cp $(ARTEFACT) ${HOME}/.local/bin/$(APPNAME)
|
||||
install: release/$(EXECUTABLE)
|
||||
echo "Installing $(EXECUTABLE) to ${HOME}/.local/bin/$(EXECUTABLE) ..."
|
||||
cp release/$(EXECUTABLE) ${HOME}/.local/bin/$(EXECUTABLE)
|
||||
.PHONY: install
|
||||
|
||||
## Create Docker image
|
||||
image:
|
||||
echo "Building Docker inage ..."
|
||||
echo "Building Docker image ..."
|
||||
docker build --rm -t ncarlier/$(APPNAME) .
|
||||
.PHONY: image
|
||||
|
||||
|
@ -63,16 +66,18 @@ changelog:
|
|||
standard-changelog --first-release
|
||||
.PHONY: changelog
|
||||
|
||||
## GZIP executable
|
||||
gzip:
|
||||
gzip $(ARTEFACT)
|
||||
.PHONY: gzip
|
||||
## Create archive
|
||||
archive: release/$(EXECUTABLE)
|
||||
echo "Creating release/$(ARCHIVE) archive..."
|
||||
tar czf release/$(ARCHIVE) README.md LICENSE CHANGELOG.md -C release/ $(EXECUTABLE)
|
||||
rm release/$(EXECUTABLE)
|
||||
.PHONY: archive
|
||||
|
||||
## Create distribution binaries
|
||||
distribution:
|
||||
GOARCH=amd64 make build gzip
|
||||
GOARCH=arm64 make build gzip
|
||||
GOARCH=arm make build gzip
|
||||
GOOS=darwin make build gzip
|
||||
distribution: changelog
|
||||
GOARCH=amd64 make build archive
|
||||
GOARCH=arm64 make build archive
|
||||
GOARCH=arm make build archive
|
||||
GOOS=darwin make build archive
|
||||
.PHONY: distribution
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user