mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-28 19:31:34 +00:00
github: tag as 'latest' only released images
This commit is contained in:
parent
345d6f059e
commit
dc610cdb7c
2 changed files with 19 additions and 5 deletions
12
.github/workflows/publish_to_dockerhub.yml
vendored
12
.github/workflows/publish_to_dockerhub.yml
vendored
|
@ -105,15 +105,23 @@ jobs:
|
|||
- name: Update Go modules
|
||||
run: go mod download
|
||||
|
||||
- name: Build images
|
||||
- name: Build image
|
||||
run: make image
|
||||
|
||||
- name: Build image with 'latest' tag
|
||||
if: ${{ github.event_name == 'release' && github.event.release.target_commitish == 'master' }}
|
||||
run: make image-latest
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Push released images to registry
|
||||
- name: Push image to registry
|
||||
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }}
|
||||
run: make image-push
|
||||
|
||||
- name: Push image with 'latest' tag to registry
|
||||
if: ${{ github.event_name == 'release' && github.event.release.target_commitish == 'master' }}
|
||||
run: make image-push-latest
|
||||
|
|
12
Makefile
12
Makefile
|
@ -18,7 +18,7 @@ IMAGE_REPO=nspccdev/neo-go
|
|||
|
||||
# All of the targets are phony here because we don't really use make dependency
|
||||
# tracking for files
|
||||
.PHONY: build deps image check-version clean-cluster push-tag push-to-registry \
|
||||
.PHONY: build deps image image-latest image-push image-push-latest check-version clean-cluster push-tag push-to-registry \
|
||||
run run-cluster test vet lint fmt cover
|
||||
|
||||
build: deps
|
||||
|
@ -50,14 +50,20 @@ postinst: install
|
|||
|
||||
image: deps
|
||||
@echo "=> Building image"
|
||||
@docker build -t $(IMAGE_REPO):latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
||||
@docker build -t $(IMAGE_REPO):$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
||||
|
||||
image-latest: deps
|
||||
@echo "=> Building image with 'latest' tag"
|
||||
@docker build -t $(IMAGE_REPO):latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
||||
|
||||
image-push:
|
||||
@echo "=> Publish image"
|
||||
@docker push $(IMAGE_REPO):latest
|
||||
@docker push $(IMAGE_REPO):$(VERSION)
|
||||
|
||||
image-push-latest:
|
||||
@echo "=> Publish image with 'latest' tag"
|
||||
@docker push $(IMAGE_REPO):latest
|
||||
|
||||
check-version:
|
||||
git fetch && (! git rev-list ${VERSION})
|
||||
|
||||
|
|
Loading…
Reference in a new issue