Skip to content

Commit 0c1db21

Browse files
committed
Add release pipeline (#16)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 3d33fd4 commit 0c1db21

File tree

3 files changed

+68
-17
lines changed

3 files changed

+68
-17
lines changed

.github/workflows/go.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
name: Go
2-
on: [push]
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'release-*'
7+
tags-ignore:
8+
- '*.*'
9+
- '*.*.*'
10+
311
jobs:
412

513
build:

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*'
7+
- '*.*.*'
8+
9+
jobs:
10+
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Check out code into the Go module directory
17+
uses: actions/checkout@v1
18+
19+
- name: Print version info
20+
id: semver
21+
run: |
22+
make version
23+
24+
- name: Set up Docker Buildx
25+
id: buildx
26+
uses: crazy-max/ghaction-docker-buildx@master
27+
with:
28+
version: latest
29+
30+
- name: Available platforms
31+
run: echo ${{ steps.buildx.outputs.platforms }}
32+
33+
- name: Build
34+
env:
35+
DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
36+
USERNAME: 1gtm
37+
APPSCODE_ENV: prod
38+
run: |
39+
docker login --username ${USERNAME} --password ${DOCKER_TOKEN}
40+
make release

Makefile

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ TAG := $(VERSION)_$(OS)_$(ARCH)
6969
TAG_PROD := $(TAG)
7070
TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH)
7171

72-
GO_VERSION ?= 1.12.7
72+
GO_VERSION ?= 1.12.10
7373
BUILD_IMAGE ?= appscode/golang-dev:$(GO_VERSION)-stretch
7474

7575
OUTBIN = bin/$(OS)_$(ARCH)/$(BIN)
@@ -80,7 +80,10 @@ endif
8080
# Directories that we need created to build/test.
8181
BUILD_DIRS := bin/$(OS)_$(ARCH) \
8282
.go/bin/$(OS)_$(ARCH) \
83-
.go/cache
83+
.go/cache \
84+
$(HOME)/.credentials \
85+
$(HOME)/.kube \
86+
$(HOME)/.minikube
8487

8588
DOCKERFILE_PROD = Dockerfile.in
8689
DOCKERFILE_DBG = Dockerfile.dbg
@@ -118,15 +121,15 @@ all-container: $(addprefix container-, $(subst /,_, $(DOCKER_PLATFORMS)))
118121
all-push: $(addprefix push-, $(subst /,_, $(DOCKER_PLATFORMS)))
119122

120123
version:
121-
@echo version=$(VERSION)
122-
@echo version_strategy=$(version_strategy)
123-
@echo git_tag=$(git_tag)
124-
@echo git_branch=$(git_branch)
125-
@echo commit_hash=$(commit_hash)
126-
@echo commit_timestamp=$(commit_timestamp)
124+
@echo ::set-output name=version::$(VERSION)
125+
@echo ::set-output name=version_strategy::$(version_strategy)
126+
@echo ::set-output name=git_tag::$(git_tag)
127+
@echo ::set-output name=git_branch::$(git_branch)
128+
@echo ::set-output name=commit_hash::$(commit_hash)
129+
@echo ::set-output name=commit_timestamp::$(commit_timestamp)
127130

128131
gen:
129-
./hack/codegen.sh
132+
@true
130133

131134
fmt: $(BUILD_DIRS)
132135
@docker run \
@@ -208,13 +211,13 @@ container: bin/.container-$(DOTFILE_IMAGE)-PROD bin/.container-$(DOTFILE_IMAGE)-
208211
bin/.container-$(DOTFILE_IMAGE)-%: bin/$(OS)_$(ARCH)/$(BIN) $(DOCKERFILE_%)
209212
@echo "container: $(IMAGE):$(TAG_$*)"
210213
@sed \
211-
-e 's|{ARG_BIN}|$(BIN)|g' \
212-
-e 's|{ARG_ARCH}|$(ARCH)|g' \
213-
-e 's|{ARG_OS}|$(OS)|g' \
214-
-e 's|{ARG_FROM}|$(BASEIMAGE_$*)|g' \
215-
-e 's|{RESTIC_VER}|$(RESTIC_VER)|g' \
216-
-e 's|{NEW_RESTIC_VER}|$(NEW_RESTIC_VER)|g' \
217-
$(DOCKERFILE_$*) > bin/.dockerfile-$*-$(OS)_$(ARCH)
214+
-e 's|{ARG_BIN}|$(BIN)|g' \
215+
-e 's|{ARG_ARCH}|$(ARCH)|g' \
216+
-e 's|{ARG_OS}|$(OS)|g' \
217+
-e 's|{ARG_FROM}|$(BASEIMAGE_$*)|g' \
218+
-e 's|{RESTIC_VER}|$(RESTIC_VER)|g' \
219+
-e 's|{NEW_RESTIC_VER}|$(NEW_RESTIC_VER)|g' \
220+
$(DOCKERFILE_$*) > bin/.dockerfile-$*-$(OS)_$(ARCH)
218221
@DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform $(OS)/$(ARCH) --load --pull -t $(IMAGE):$(TAG_$*) -f bin/.dockerfile-$*-$(OS)_$(ARCH) .
219222
@docker images -q $(IMAGE):$(TAG_$*) > $@
220223
@echo

0 commit comments

Comments
 (0)