forked from TrueCloudLab/neoneo-go
Merge pull request #1778 from nspcc-dev/ci-fix-latest
github: publish as 'latest' only master releases
This commit is contained in:
commit
b4dfb4691d
3 changed files with 31 additions and 17 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
|
- name: Update Go modules
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
||||||
- name: Build images
|
- name: Build image
|
||||||
run: make 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
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
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') }}
|
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }}
|
||||||
run: make image-push
|
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
|
||||||
|
|
18
Makefile
18
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
|
# All of the targets are phony here because we don't really use make dependency
|
||||||
# tracking for files
|
# 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
|
run run-cluster test vet lint fmt cover
|
||||||
|
|
||||||
build: deps
|
build: deps
|
||||||
|
@ -50,14 +50,20 @@ postinst: install
|
||||||
|
|
||||||
image: deps
|
image: deps
|
||||||
@echo "=> Building image"
|
@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) .
|
@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:
|
image-push:
|
||||||
@echo "=> Publish image"
|
@echo "=> Publish image"
|
||||||
@docker push $(IMAGE_REPO):latest
|
|
||||||
@docker push $(IMAGE_REPO):$(VERSION)
|
@docker push $(IMAGE_REPO):$(VERSION)
|
||||||
|
|
||||||
|
image-push-latest:
|
||||||
|
@echo "=> Publish image with 'latest' tag"
|
||||||
|
@docker push $(IMAGE_REPO):latest
|
||||||
|
|
||||||
check-version:
|
check-version:
|
||||||
git fetch && (! git rev-list ${VERSION})
|
git fetch && (! git rev-list ${VERSION})
|
||||||
|
|
||||||
|
@ -71,12 +77,6 @@ push-tag:
|
||||||
git tag ${VERSION}
|
git tag ${VERSION}
|
||||||
git push origin ${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
|
run: build
|
||||||
${BINARY} node -config-path ./config -${NETMODE}
|
${BINARY} node -config-path ./config -${NETMODE}
|
||||||
|
|
||||||
|
|
18
README.md
18
README.md
|
@ -50,15 +50,15 @@ make deps
|
||||||
|
|
||||||
### Docker
|
### 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
|
```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
|
### Building
|
||||||
|
@ -71,8 +71,14 @@ make build
|
||||||
|
|
||||||
### Running
|
### 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
|
make run
|
||||||
```
|
```
|
||||||
|
@ -83,7 +89,7 @@ To run the binary directly:
|
||||||
./bin/neo-go node
|
./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
|
./bin/neo-go node --mainnet
|
||||||
|
|
Loading…
Reference in a new issue