-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
2,551 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*.*" | ||
- "*.*.*" | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Print version info | ||
id: semver | ||
run: | | ||
make version | ||
- name: Set up QEMU | ||
id: qemu | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to the GitHub Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: 1gtm | ||
password: ${{ secrets.LGTM_GITHUB_TOKEN }} | ||
|
||
- name: Run checks | ||
run: | | ||
make ci | ||
- name: Build | ||
run: | | ||
make release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bin | ||
*/bin | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM alpine | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
LABEL org.opencontainers.image.source https://github.com/kluster-api/capi-scripts | ||
|
||
RUN apk add --no-cache bash curl ca-certificates | ||
|
||
COPY scripts /tmp/scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
SHELL=/bin/bash -o pipefail | ||
|
||
REGISTRY ?= ghcr.io/appscode | ||
BIN ?= capi-scripts | ||
IMAGE := $(REGISTRY)/$(BIN) | ||
TAG ?= $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "") | ||
|
||
DOCKER_PLATFORMS := linux/amd64 linux/arm64 | ||
PLATFORM ?= linux/$(subst x86_64,amd64,$(subst aarch64,arm64,$(shell uname -m))) | ||
VERSION = $(TAG)_$(subst /,_,$(PLATFORM)) | ||
|
||
container-%: | ||
@$(MAKE) container \ | ||
--no-print-directory \ | ||
PLATFORM=$(subst _,/,$*) | ||
|
||
push-%: | ||
@$(MAKE) push \ | ||
--no-print-directory \ | ||
PLATFORM=$(subst _,/,$*) | ||
|
||
all-container: $(addprefix container-, $(subst /,_,$(DOCKER_PLATFORMS))) | ||
|
||
all-push: $(addprefix push-, $(subst /,_,$(DOCKER_PLATFORMS))) | ||
|
||
.PHONY: container | ||
container: | ||
@echo "container: $(IMAGE):$(VERSION)" | ||
@docker buildx build --platform $(PLATFORM) --load --pull -t $(IMAGE):$(VERSION) -f Dockerfile . | ||
@echo | ||
|
||
push: container | ||
@docker push $(IMAGE):$(VERSION) | ||
@echo "pushed: $(IMAGE):$(VERSION)" | ||
@echo | ||
|
||
.PHONY: docker-manifest | ||
docker-manifest: | ||
docker manifest create -a $(IMAGE):$(TAG) $(foreach PLATFORM,$(DOCKER_PLATFORMS),$(IMAGE):$(TAG)_$(subst /,_,$(PLATFORM))) | ||
docker manifest push $(IMAGE):$(TAG) | ||
|
||
.PHONY: release | ||
release: | ||
@$(MAKE) all-push docker-manifest --no-print-directory | ||
|
||
.PHONY: version | ||
version: | ||
@echo version=$(VERSION) | ||
|
||
.PHONY: fmt | ||
fmt: | ||
@find . -path ./vendor -prune -o -name '*.sh' -exec shfmt -l -w -ci -i 4 {} \; | ||
|
||
.PHONY: verify | ||
verify: fmt | ||
@if !(git diff --exit-code HEAD); then \ | ||
echo "files are out of date, run make fmt"; exit 1; \ | ||
fi | ||
|
||
.PHONY: ci | ||
ci: verify | ||
|
||
# make and load docker image to kind cluster | ||
.PHONY: push-to-kind | ||
push-to-kind: container | ||
@echo "Loading docker image into kind cluster...." | ||
@kind load docker-image $(IMAGE):$(VERSION) | ||
@echo "Image has been pushed successfully into kind cluster." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# capi-scripts | ||
|
||
* `make release` |
Oops, something went wrong.