mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-22 18:06:11 +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 }}
|
||||
|
|
|
|||
16
.github/workflows/publish.yml
vendored
16
.github/workflows/publish.yml
vendored
|
|
@ -2,7 +2,7 @@ name: publish
|
|||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
|
|
@ -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
|
||||
|
|
|
|||
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
|
|
@ -23,13 +23,14 @@ 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 }}
|
||||
username: ${{ secrets.QUAY_IO_USER }}
|
||||
password: ${{ secrets.QUAY_IO_TOKEN }}
|
||||
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
|
|
|
|||
17
Makefile
17
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
|
||||
|
||||
|
|
@ -55,7 +70,7 @@ changelog: build ## Generate changelog
|
|||
./git-chglog --next-tag $(VERSION) -o CHANGELOG.md
|
||||
|
||||
.PHONY: release
|
||||
release: changelog ## Release a new tag
|
||||
release: changelog ## Release a new tag
|
||||
@ $(MAKE) --no-print-directory log-$@
|
||||
git add CHANGELOG.md
|
||||
git commit -m "chore: update changelog for $(VERSION)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue