mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-23 02:15:12 +00:00
chore: add docker target to Makefile (#138)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
parent
f76afed086
commit
7cc56b1256
4 changed files with 29 additions and 12 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
|
@ -13,6 +13,7 @@ on:
|
|||
|
||||
env:
|
||||
GO_VERSION: "1.16"
|
||||
GOLANGCI_VERSION: "v1.38"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
|
|
@ -54,4 +55,4 @@ jobs:
|
|||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: v1.38
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
|
|
|
|||
14
.github/workflows/publish.yml
vendored
14
.github/workflows/publish.yml
vendored
|
|
@ -10,26 +10,26 @@ env:
|
|||
DOCKER_REGISTRY: "quay.io"
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
docker:
|
||||
runs-on: ubuntu-20.04
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: Build go binary
|
||||
run: make build
|
||||
- name: Login to GitHub Packages Docker Registry
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.DOCKER_REGISTRY }}
|
||||
username: ${{ secrets.QUAY_IO_USER }}
|
||||
password: ${{ secrets.QUAY_IO_TOKEN }}
|
||||
|
||||
- name: Build and Push docker image
|
||||
run: |
|
||||
docker build --pull --tag ${{ env.DOCKER_REGISTRY }}/git-chglog/git-chglog:edge .
|
||||
docker push ${{ env.DOCKER_REGISTRY }}/git-chglog/git-chglog:edge
|
||||
run: DOCKER_TAG=edge make docker push
|
||||
|
|
|
|||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
|
|
@ -23,7 +23,8 @@ jobs:
|
|||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: Login to GitHub Packages Docker Registry
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.DOCKER_REGISTRY }}
|
||||
|
|
|
|||
15
Makefile
15
Makefile
|
|
@ -9,6 +9,11 @@ GOHOST ?= GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO)
|
|||
|
||||
LDFLAGS ?= "-X main.version=$(VERSION)"
|
||||
|
||||
# Docker variables
|
||||
DEFAULT_TAG ?= $(shell echo "$(VERSION)" | tr -d 'v')
|
||||
DOCKER_IMAGE := quay.io/git-chglog/git-chglog
|
||||
DOCKER_TAG ?= $(DEFAULT_TAG)
|
||||
|
||||
.PHONY: all
|
||||
all: help
|
||||
|
||||
|
|
@ -46,6 +51,16 @@ install: ## Install git-chglog
|
|||
@ $(MAKE) --no-print-directory log-$@
|
||||
$(GOHOST) install ./cmd/git-chglog
|
||||
|
||||
.PHONY: docker
|
||||
docker: build ## Build Docker image
|
||||
@ $(MAKE) --no-print-directory log-$@
|
||||
docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) .
|
||||
|
||||
.PHONY: push
|
||||
push: ## Push Docker image
|
||||
@ $(MAKE) --no-print-directory log-$@
|
||||
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)
|
||||
|
||||
###########
|
||||
##@ Release
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue