Skip to content

Commit c4eb920

Browse files
committed
Add release pipeline (#4)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 02b9a9f commit c4eb920

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

.github/workflows/go.yml

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

512
build:

.github/workflows/release.yml

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

Makefile

Lines changed: 14 additions & 14 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)
@@ -118,12 +118,12 @@ all-container: $(addprefix container-, $(subst /,_, $(DOCKER_PLATFORMS)))
118118
all-push: $(addprefix push-, $(subst /,_, $(DOCKER_PLATFORMS)))
119119

120120
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)
121+
@echo ::set-output name=version::$(VERSION)
122+
@echo ::set-output name=version_strategy::$(version_strategy)
123+
@echo ::set-output name=git_tag::$(git_tag)
124+
@echo ::set-output name=git_branch::$(git_branch)
125+
@echo ::set-output name=commit_hash::$(commit_hash)
126+
@echo ::set-output name=commit_timestamp::$(commit_timestamp)
127127

128128
gen:
129129
@true
@@ -208,13 +208,13 @@ container: bin/.container-$(DOTFILE_IMAGE)-PROD bin/.container-$(DOTFILE_IMAGE)-
208208
bin/.container-$(DOTFILE_IMAGE)-%: bin/$(OS)_$(ARCH)/$(BIN) $(DOCKERFILE_%)
209209
@echo "container: $(IMAGE):$(TAG_$*)"
210210
@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)
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)
218218
@DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform $(OS)/$(ARCH) --load --pull -t $(IMAGE):$(TAG_$*) -f bin/.dockerfile-$*-$(OS)_$(ARCH) .
219219
@docker images -q $(IMAGE):$(TAG_$*) > $@
220220
@echo

0 commit comments

Comments
 (0)