Skip to content

Commit 6f2f485

Browse files
committed
docs(build): publish, docker-tag, docker-publish
1 parent 00a4bdb commit 6f2f485

1 file changed

Lines changed: 178 additions & 1 deletion

File tree

README.md

Lines changed: 178 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,143 @@ Building cmd/webserver
392392
OK
393393
```
394394

395+
#### Publish
396+
397+
Publish tagged binary to Github (as a Release). Under the hood, the [`goreleaser`](https://github.com/goreleaser/goreleaser) tool is used.
398+
399+
A prerequisite to this target is that a file named `.github.yml` at the home directory (`~/.github.yml`) contains a `GITHUB_TOKEN` property.
400+
401+
```console
402+
neon publish
403+
----------------------------------------------- info --
404+
MODULE = github.com/adrienaury/go-template
405+
PROJECT = go-template
406+
TAG = refactor
407+
COMMIT = 00a4bdbf147a4394aa1e7f0483802f94658e9ce3
408+
DATE = 2021-05-02
409+
BY = adrienaury@gmail.com
410+
RELEASE = no
411+
--------------------------------------------- refresh --
412+
go: creating new go.mod: module github.com/adrienaury/go-template
413+
go: to add module requirements and sums:
414+
go mod tidy
415+
------------------------------------------------ lint --
416+
Running command: golangci-lint run --fast --enable-all --disable scopelint --disable forbidigo
417+
------------------------------------------------ test --
418+
? github.com/adrienaury/go-template/cmd/cli [no test files]
419+
? github.com/adrienaury/go-template/cmd/webserver [no test files]
420+
? github.com/adrienaury/go-template/internal/helloservice [no test files]
421+
? github.com/adrienaury/go-template/pkg/nameservice [no test files]
422+
--------------------------------------------- publish --
423+
424+
• releasing...
425+
• loading config file file=bin/.goreleaser.yml
426+
• loading environment variables
427+
• getting and validating git state
428+
• releasing v0.1.0, commit 00a4bdbf147a4394aa1e7f0483802f94658e9ce3
429+
• pipe skipped error=disabled during snapshot mode
430+
• parsing tag
431+
• running before hooks
432+
• running go mod download
433+
• setting defaults
434+
• snapshotting
435+
• github/gitlab/gitea releases
436+
• project name
437+
• loading go mod information
438+
• building binaries
439+
• creating source archive
440+
• archives
441+
• linux packages
442+
• snapcraft packages
443+
• calculating checksums
444+
• signing artifacts
445+
• docker images
446+
• artifactory
447+
• blobs
448+
• homebrew tap formula
449+
• scoop manifests
450+
• milestones
451+
• snapshotting
452+
• checking ./dist
453+
• --rm-dist is set, cleaning it up
454+
• loading go mod information
455+
• writing effective config file
456+
• writing config=bin/dist/config.yaml
457+
• generating changelog
458+
• pipe skipped error=not available for snapshots
459+
• building binaries
460+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_windows_386/cli.exe
461+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_darwin_arm64/cli
462+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_linux_arm64/cli
463+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_linux_386/cli
464+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_windows_amd64/cli.exe
465+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_darwin_amd64/cli
466+
• building binary=/workspaces/go-template/bin/dist/cmd/cli_linux_amd64/cli
467+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_windows_386/webserver.exe
468+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_linux_amd64/webserver
469+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_linux_386/webserver
470+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_windows_amd64/webserver.exe
471+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_darwin_amd64/webserver
472+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_darwin_arm64/webserver
473+
• building binary=/workspaces/go-template/bin/dist/cmd/webserver_linux_arm64/webserver
474+
• archives
475+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_windows_386.tar.gz
476+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_linux_386.tar.gz
477+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_darwin_arm64.tar.gz
478+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_windows_amd64.tar.gz
479+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_linux_amd64.tar.gz
480+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_linux_arm64.tar.gz
481+
• creating archive=bin/dist/go-template_v0.1.0-SNAPSHOT-00a4bdb_darwin_amd64.tar.gz
482+
• creating source archive
483+
• linux packages
484+
• snapcraft packages
485+
• calculating checksums
486+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_windows_amd64.tar.gz
487+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_darwin_arm64.tar.gz
488+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_linux_amd64.tar.gz
489+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_darwin_amd64.tar.gz
490+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_linux_arm64.tar.gz
491+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_windows_386.tar.gz
492+
• checksumming file=go-template_v0.1.0-SNAPSHOT-00a4bdb_linux_386.tar.gz
493+
• signing artifacts
494+
• docker images
495+
• publishing
496+
• blobs
497+
• http upload
498+
• custom publisher
499+
• artifactory
500+
• docker images
501+
• pipe skipped error=publishing is disabled
502+
• docker manifests
503+
• pipe skipped error=publishing is disabled
504+
• snapcraft packages
505+
• pipe skipped error=publishing is disabled
506+
• github/gitlab/gitea releases
507+
• pipe skipped error=publishing is disabled
508+
• homebrew tap formula
509+
• scoop manifests
510+
• pipe skipped error=publishing is disabled
511+
• milestones
512+
• pipe skipped error=publishing is disabled
513+
• release succeeded after 1.39s
514+
OK
515+
```
516+
517+
The build properties are the same as the [`compile`](#compile) target.
518+
395519
#### Docker
396520

397521
Build docker images locally.
398522

523+
Dockerfiles and build contexts are configured by the `dockerfiles` map. It'a map with Dockerfiles paths as keys and context paths as values. The default value is `{"Dockerfile": ".", "Dockerfile.webserver", "."}` which will build both Dockerfiles present at the root of this template with a build context equal to the current directory (root directory).
524+
525+
The images are named according to a few rules :
526+
527+
- if the source Dockerfile has an extension (e.g. `Dockerfile.webserver`) then the image built will be named `<DOCKERHUB_USER>/<PROJECT>-<EXTENSION>` (e.g. : `Dockerfile.webserver` will produce an image named `<DOCKERHUB_USER>/<PROJECT>-webserver`)
528+
- if the source Dockerfile hasn't an extension (e.g. `Dockerfile`) then the image built will be named `<DOCKERHUB_USER>/<PROJECT>`
529+
530+
A prerequisite to this target is that a file named `.dockerhub.yml` at the home directory (`~/.dockerhub.yml`) contains a `DOCKERHUB_USER` property.
531+
399532
```console
400533
neon docker
401534
----------------------------------------------- info --
@@ -412,7 +545,7 @@ adrienaury/go-template-webserver refactor sha
412545
OK
413546
```
414547

415-
To configure the docker target, edit the `build.yml` file and look for the property named `dockerfiles`. It'a map with Dockerfiles paths as keys and context paths as values. The default value is `{"Dockerfile": ".", "Dockerfile.webserver", "."}` which will build both Dockerfiles present at the root of this template with a build context equal to the current directory (root directory).
548+
To configure the docker target, edit the `build.yml` file and look for the property named `dockerfiles`.
416549

417550
The `dockerfiles` map can also be passed by the `neon -props` flag.
418551

@@ -431,6 +564,50 @@ adrienaury/go-template refactor sha
431564
OK
432565
```
433566

567+
#### Docker-tag
568+
569+
Tag docker images. This target will run only if the tag being built is a release tag (vX.Y.Z).
570+
571+
It will tag all docker images with [semantic docker tags](https://medium.com/@mccode/using-semantic-versioning-for-docker-image-tags-dfde8be06699).
572+
573+
The build properties are the same as the [`docker`](#docker) target (a `dockerfiles` map).
574+
575+
```console
576+
$ neon docker-tag
577+
----------------------------------------------- info --
578+
MODULE = github.com/adrienaury/go-template
579+
PROJECT = go-template
580+
TAG = v0.2.0
581+
COMMIT = 00a4bdbf147a4394aa1e7f0483802f94658e9ce3
582+
DATE = 2021-05-02
583+
BY = adrienaury@gmail.com
584+
RELEASE = yes
585+
VERSION = 0.2.0
586+
--------------------------------------------- docker --
587+
adrienaury/go-template refactor sha256:d05a1e1e5119aab03f3e3e33fa56d7db66ae5634beb53827b0e69fa168e3c595 20 minutes ago 20.6MB
588+
adrienaury/go-template v0.2.0 sha256:d05a1e1e5119aab03f3e3e33fa56d7db66ae5634beb53827b0e69fa168e3c595 20 minutes ago 20.6MB
589+
adrienaury/go-template-webserver refactor sha256:14b333b3679a64b3255e7c88e7211fa4b7502e2664e7b482373b392d5615414c 20 minutes ago 20.6MB
590+
adrienaury/go-template-webserver v0.2.0 sha256:14b333b3679a64b3255e7c88e7211fa4b7502e2664e7b482373b392d5615414c 20 minutes ago 20.6MB
591+
----------------------------------------- docker-tag --
592+
adrienaury/go-template refactor sha256:d05a1e1e5119aab03f3e3e33fa56d7db66ae5634beb53827b0e69fa168e3c595 20 minutes ago 20.6MB
593+
adrienaury/go-template v0 sha256:d05a1e1e5119aab03f3e3e33fa56d7db66ae5634beb53827b0e69fa168e3c595 20 minutes ago 20.6MB
594+
adrienaury/go-template v0.2 sha256:d05a1e1e5119aab03f3e3e33fa56d7db66ae5634beb53827b0e69fa168e3c595 20 minutes ago 20.6MB
595+
adrienaury/go-template v0.2.0 sha256:d05a1e1e5119aab03f3e3e33fa56d7db66ae5634beb53827b0e69fa168e3c595 20 minutes ago 20.6MB
596+
adrienaury/go-template-webserver refactor sha256:14b333b3679a64b3255e7c88e7211fa4b7502e2664e7b482373b392d5615414c 20 minutes ago 20.6MB
597+
adrienaury/go-template-webserver v0 sha256:14b333b3679a64b3255e7c88e7211fa4b7502e2664e7b482373b392d5615414c 20 minutes ago 20.6MB
598+
adrienaury/go-template-webserver v0.2 sha256:14b333b3679a64b3255e7c88e7211fa4b7502e2664e7b482373b392d5615414c 20 minutes ago 20.6MB
599+
adrienaury/go-template-webserver v0.2.0 sha256:14b333b3679a64b3255e7c88e7211fa4b7502e2664e7b482373b392d5615414c 20 minutes ago 20.6MB
600+
OK
601+
```
602+
603+
#### Docker-publish
604+
605+
Publish tagged docker images to Dockerhub.
606+
607+
A prerequisite to this target is that a file named `.dockerhub.yml` at the home directory (`~/.dockerhub.yml`) contains a `DOCKERHUB_USER` property and a `DOCKERHUB_PASS` property.
608+
609+
The build properties are the same as the [`docker`](#docker) target (a `dockerfiles` map).
610+
434611
## Contributing
435612

436613
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

0 commit comments

Comments
 (0)