Merge pull request #1778 from nspcc-dev/ci-fix-latest

github: publish as 'latest' only master releases
This commit is contained in:
Roman Khimov 2021-02-26 13:38:46 +03:00 committed by GitHub
commit b4dfb4691d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 17 deletions

View file

@ -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

View file

@ -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 \
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})
@ -71,12 +77,6 @@ push-tag:
git tag ${VERSION}
git push origin ${VERSION}
push-to-registry:
@docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS}
@docker tag CityOfZion/${REPONAME}:latest CityOfZion/${REPONAME}:${CIRCLE_TAG}
@docker push CityOfZion/${REPONAME}:${CIRCLE_TAG}
@docker push CityOfZion/${REPONAME}
run: build
${BINARY} node -config-path ./config -${NETMODE}

View file

@ -50,15 +50,15 @@ make deps
### Docker
Each tagged build is built to docker hub and the `:latest` tag pointing at the latest tagged build.
Each tagged build is published to docker hub and the `:latest` tag pointing at the latest tagged master build.
By default the `CMD` is set to run a node on `testnet`, so to do this simply run:
By default the `CMD` is set to run a node on `privnet`, so to do this simply run:
```bash
docker run -d --name neo-go -p 20332:20332 -p 20333:20333 cityofzion/neo-go
docker run -d --name neo-go -p 20332:20332 -p 20331:20331 nspccdev/neo-go
```
Which will start a node on `testnet` and expose the nodes port `20333` and `20332` for the `JSON-RPC` server.
Which will start a node on `privnet` and expose the nodes port `20332` and `20331` for the `JSON-RPC` server.
### Building
@ -71,8 +71,14 @@ make build
### Running
Quick start a NEO node on the private network. This requires the [neo-privatenet](https://hub.docker.com/r/cityofzion/neo-privatenet/) Docker image running on your machine.
Quick start a NEO node on the private network.
To build and run the private network image locally, use:
```
make env_image
make env_up
```
To start a NEO node on the private network:
```
make run
```
@ -83,7 +89,7 @@ To run the binary directly:
./bin/neo-go node
```
By default the node will run on the `private network`, to change his:
By default the node will run on the private network, to change this:
```
./bin/neo-go node --mainnet