Compare commits

..

155 Commits

Author SHA1 Message Date
lukaszraczylo d7f5610110 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-17 03:13:50 +00:00
lukaszraczylo ce31233c55 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-11 03:07:00 +00:00
lukaszraczylo 2d997993ec Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-10 03:07:24 +00:00
lukaszraczylo a5b861ee36 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-09 03:05:16 +00:00
lukaszraczylo 8771fe5a0b Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-08 03:04:49 +00:00
lukaszraczylo 2f33609171 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-01 03:13:10 +00:00
lukaszraczylo 8a4f34ba1e Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-30 03:07:41 +00:00
lukaszraczylo 3ce355f9c2 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-22 03:07:13 +00:00
lukaszraczylo e3a8b37d56 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-19 03:06:26 +00:00
lukaszraczylo 4cda329513 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-16 03:08:14 +00:00
lukaszraczylo 1672a9c3fe Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-13 03:09:04 +00:00
lukaszraczylo 99a2236c36 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-11 03:06:15 +00:00
lukaszraczylo 57b0a013d7 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-10 03:06:48 +00:00
lukaszraczylo eedc099648 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-07 03:09:04 +00:00
lukaszraczylo dbf46f11f3 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-06 03:10:05 +00:00
lukaszraczylo 5f21d71b50 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-05 03:06:08 +00:00
lukaszraczylo b0f448b810 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-04 03:06:59 +00:00
lukaszraczylo 3c61b6d709 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-03 03:06:13 +00:00
lukaszraczylo 481f916b51 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-01 03:13:08 +00:00
lukaszraczylo 888525e4d2 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-30 03:10:33 +00:00
lukaszraczylo c789560b31 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-29 03:09:40 +00:00
lukaszraczylo f568197a00 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-26 03:07:12 +00:00
lukaszraczylo e6bb79646b Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-25 03:08:04 +00:00
lukaszraczylo 26d0c3bcd6 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-17 03:03:15 +00:00
lukaszraczylo f6da1de36f Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-14 03:02:50 +00:00
lukaszraczylo 4aae40ef34 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-12 03:02:37 +00:00
lukaszraczylo 66538c4bdb Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-10 03:03:27 +00:00
lukaszraczylo df95d6a0e2 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-09 03:04:26 +00:00
lukaszraczylo f6ee659f39 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-08 03:04:07 +00:00
lukaszraczylo 376e857d3e Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-07 03:02:43 +00:00
lukaszraczylo f6938c7a32 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-06 03:03:27 +00:00
lukaszraczylo dcd8bb922f Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-05 03:02:12 +00:00
lukaszraczylo f6196743e8 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-24 03:02:27 +00:00
lukaszraczylo 8a34562f19 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-23 03:02:05 +00:00
lukaszraczylo c8dba1132e fixup! Add debug mode parameter. 2024-08-22 22:54:23 +01:00
lukaszraczylo d4b99cb84e Add debug mode parameter. 2024-08-22 22:41:11 +01:00
lukaszraczylo f00399804b Improvement: Use current directory ( be more self hosted runner friendly ) 2024-08-22 22:17:42 +01:00
lukaszraczylo 08fff358b4 Update entrypoint.sh 2024-08-22 20:18:53 +01:00
lukaszraczylo b64578ba8a Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-21 03:02:38 +00:00
lukaszraczylo acc310880d Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-18 03:02:14 +00:00
lukaszraczylo 27e7d40c0a Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-11 03:02:29 +00:00
lukaszraczylo 079fd59952 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-10 03:02:54 +00:00
lukaszraczylo 5c0d2109b0 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-09 03:02:56 +00:00
lukaszraczylo 3d89a11084 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-08 03:02:25 +00:00
lukaszraczylo 5ad41dc08b Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-07 03:02:34 +00:00
lukaszraczylo 721453e383 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-06 03:02:41 +00:00
lukaszraczylo 81b813d136 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-05 03:01:59 +00:00
lukaszraczylo b15fac4856 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-02 03:02:48 +00:00
lukaszraczylo cfd933f283 Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-01 03:02:36 +00:00
lukaszraczylo af3572a9df Update go.mod and go.sum
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-31 15:35:46 +00:00
lukaszraczylo df00bc19bc Update autoupdate.yaml 2024-07-31 16:34:05 +01:00
lukaszraczylo 82a520b858 Update autoupdate.yaml 2024-07-31 16:31:27 +01:00
lukaszraczylo d1987d08bc Update autoupdate.yaml 2024-07-31 16:29:11 +01:00
lukaszraczylo eb513ca5f9 Add autoupdate workflow 2024-07-23 16:11:17 +01:00
lukaszraczylo f51cb018cf Update dependencies. 2024-07-23 12:14:17 +01:00
lukaszraczylo 3d75e166af Update dependencies. 2024-05-04 21:56:57 +01:00
lukaszraczylo 6c1281a87b Update dependencies. 2024-05-04 21:21:57 +01:00
lukaszraczylo e709f61317 fixup! fixup! Move to distroless images. 2024-02-08 20:40:40 +00:00
lukaszraczylo c49e94b36a fixup! Move to distroless images. 2024-02-08 20:38:53 +00:00
lukaszraczylo dead601864 Move to distroless images. 2024-02-08 17:08:18 +00:00
lukaszraczylo eea0b9031d Update all the dependencies. 2024-01-09 10:23:51 +00:00
lukaszraczylo c8759d43e9 Merge pull request #39 from lukaszraczylo/dependabot/go_modules/github.com/cloudflare/circl-1.3.7
Bump github.com/cloudflare/circl from 1.3.5 to 1.3.7
2024-01-09 09:32:35 +00:00
dependabot[bot] 343496c6c3 Bump github.com/cloudflare/circl from 1.3.5 to 1.3.7
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.5...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 16:52:06 +00:00
lukaszraczylo 129acb3cfe Create dependabot.yml 2023-10-20 10:19:00 +01:00
lukaszraczylo ca3d1b6da0 Use well tested logging sub-library. 2023-10-20 10:15:26 +01:00
lukaszraczylo 3c96bdd3c2 Merge pull request #24 from lukaszraczylo/updates
Dependencies updates and bit of a speedup
2023-10-20 09:44:06 +01:00
lukaszraczylo b999885e0e Ignore action configuration. 2023-10-20 09:43:20 +01:00
lukaszraczylo 5e945c4ba0 Force use of the docker container instead of building the image on the fly. 2023-10-20 09:42:31 +01:00
lukaszraczylo e8742c29b5 Force Go 1.21 2023-10-20 09:31:24 +01:00
lukaszraczylo e168e99151 Hotfix: Invalid golang version in go mod [?] 2023-09-06 09:36:13 +01:00
lukaszraczylo e54b3d339b Update dependencies [maintenance release] 2023-09-06 09:32:46 +01:00
lukaszraczylo 403b3f115f Update dependencies. 2023-05-26 16:38:26 +01:00
lukaszraczylo 76fdbd6f50 fixup! Merge pull request #22 from lukaszraczylo/add-branch-support 2023-05-09 13:57:57 +01:00
lukaszraczylo 67d110295f Merge pull request #22 from lukaszraczylo/add-branch-support
Modify tests to reflect addition of the branch flag.
2023-05-09 11:20:17 +00:00
lukaszraczylo 5c63edcc2e Merge pull request #21 from username-dorf/feat/branch-support
Add branch support for remote repository
2023-05-09 11:19:54 +00:00
lukaszraczylo 1bf33c3a65 Modify tests to reflect addition of the branch flag. 2023-05-09 12:14:49 +01:00
username-dorf 3859fe0469 Update README 2023-05-08 12:03:01 +03:00
username-dorf ac953ab411 Add branch selection for remote repo 2023-05-05 15:12:21 +03:00
lukaszraczylo 9e333c7a45 Update dependencies. 2023-04-11 13:53:17 +01:00
lukaszraczylo 80e669e5b5 Update dependencies. 2023-04-08 21:41:53 +01:00
lukaszraczylo fd32148a53 Update dependency. 2023-04-08 02:21:18 +01:00
lukaszraczylo 0fa3b15a5c Update dependencies, move gjson -> ask 2023-04-08 01:42:01 +01:00
lukaszraczylo 6a34323712 Update dependencies. 2023-03-31 15:37:53 +01:00
lukaszraczylo eeba71c954 Enforce go version 1.20.2 2023-03-31 15:35:37 +01:00
lukaszraczylo a73dd78bd5 Decrease memory footprint by realigning struct members. 2023-03-31 15:34:49 +01:00
lukaszraczylo 817fb91dba Add support for additional flags
Supported flags:
* -e - respect existing tags
* -s - strict matching
2023-03-30 13:53:18 +01:00
lukaszraczylo 601f486b60 Merge pull request #18 from lukaszraczylo/dependabot/go_modules/golang.org/x/net-0.7.0
bump golang.org/x/net from 0.5.0 to 0.7.0
2023-02-19 16:15:34 +00:00
dependabot[bot] 5203ba9f8b bump golang.org/x/net from 0.5.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.5.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.5.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-18 04:02:46 +00:00
lukaszraczylo 9e54d213a7 Update github actions to use latest versions. 2023-02-02 10:33:59 +00:00
lukaszraczylo acdc87db7d Fix typo on semantic version output setup. 2023-02-02 10:20:47 +00:00
lukaszraczylo 5aaaf3c599 fixup! Build docker image only after binary build succeeded. 2023-02-02 10:02:31 +00:00
lukaszraczylo de8d0dba1d Build docker image only after binary build succeeded. 2023-02-02 09:58:07 +00:00
lukaszraczylo b51ea576a3 fixup! fixup! Fix pipefail in entrypoint.sh 2023-02-02 09:56:42 +00:00
lukaszraczylo a1c81c7120 fixup! Fix pipefail in entrypoint.sh 2023-02-02 09:45:44 +00:00
lukaszraczylo 2f78fd46ef Fix pipefail in entrypoint.sh 2023-02-02 09:38:50 +00:00
lukaszraczylo ecd0363c45 Update build action and issue of the v1 release. 2023-02-02 09:35:25 +00:00
lukaszraczylo 2405a93eb2 Update codecov action v1->v3 2023-01-16 18:16:58 +00:00
lukaszraczylo c97f47c48b fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Switch to goreleaser. 2023-01-16 18:09:56 +00:00
lukaszraczylo 8217ece82d fixup! fixup! fixup! fixup! fixup! fixup! fixup! Switch to goreleaser. 2023-01-16 17:58:10 +00:00
lukaszraczylo c601de437d fixup! fixup! fixup! fixup! fixup! fixup! Switch to goreleaser. 2023-01-16 17:55:05 +00:00
lukaszraczylo c03086e36c fixup! fixup! fixup! fixup! fixup! Switch to goreleaser. 2023-01-16 17:49:15 +00:00
lukaszraczylo b20a9f8eb7 fixup! fixup! fixup! fixup! Switch to goreleaser. 2023-01-16 17:36:05 +00:00
lukaszraczylo 19fd1d8d3e fixup! fixup! fixup! Switch to goreleaser. 2023-01-16 17:23:47 +00:00
lukaszraczylo 37a6482e74 fixup! fixup! Switch to goreleaser. 2023-01-16 17:11:47 +00:00
lukaszraczylo 9c1e1f2217 fixup! Switch to goreleaser. 2023-01-16 17:11:12 +00:00
lukaszraczylo 746defdaa2 Switch to goreleaser. 2023-01-16 17:03:59 +00:00
lukaszraczylo fc44b5644c fixup! fixup! Prevent download+update of the dependencies. 2023-01-16 14:55:44 +00:00
lukaszraczylo 1cba7edb6a fixup! Prevent download+update of the dependencies. 2023-01-16 14:50:24 +00:00
lukaszraczylo e04690acdb Prevent download+update of the dependencies. 2023-01-16 14:47:53 +00:00
lukaszraczylo a517359fec Update dependencies. 2023-01-16 14:40:47 +00:00
lukaszraczylo 6057b7502d Update release.yaml 2023-01-16 06:33:02 -08:00
lukaszraczylo 95d80e71cc Update release.yaml 2023-01-16 06:29:53 -08:00
lukaszraczylo 96228eaac7 Quick update on the soon-to-be-depreciated outputs usage. 2023-01-13 16:10:04 +00:00
lukaszraczylo ea75bd4816 fixup! fixup! fixup! Update code constraints. 2022-12-10 13:43:16 +00:00
lukaszraczylo 36e0617b29 fixup! fixup! Update code constraints. 2022-12-10 13:37:38 +00:00
lukaszraczylo 957f17f0a5 fixup! Update code constraints. 2022-12-10 13:30:57 +00:00
lukaszraczylo e9e05973a4 Update code constraints. 2022-12-10 12:48:57 +00:00
lukaszraczylo 04d31b5e78 Update dockerfile. 2022-12-10 12:42:07 +00:00
lukaszraczylo 7fa90bf397 fixup! Fix download URL for missing assets. 2022-12-10 12:25:47 +00:00
lukaszraczylo 491bb087ab Fix download URL for missing assets. 2022-12-10 12:23:04 +00:00
lukaszraczylo f81072b1fe Enforce Go 1.19 for builds. 2022-12-10 12:10:33 +00:00
lukaszraczylo d3f6b007a3 Replace update with update-all 2022-12-10 12:07:07 +00:00
lukaszraczylo b786463ed6 fixup! fixup! Update dependencies. 2022-12-10 12:01:21 +00:00
lukaszraczylo 901f16a331 fixup! Update dependencies. 2022-12-10 11:49:42 +00:00
lukaszraczylo 7bb6a0d0f6 Update dependencies. 2022-12-10 11:48:30 +00:00
lukaszraczylo c08aeae7f1 Some builds could have issues with precached apk dependencies. 2022-11-03 13:10:38 +00:00
lukaszraczylo 915c9a9f71 Compile and release semver and the V1 tag. 2022-11-03 10:39:43 +00:00
lukaszraczylo 7787fe5e6c Exclude md5 checks on binary. 2022-10-17 15:39:51 +01:00
lukaszraczylo be885367df Increase test coverage. 2022-10-17 15:30:21 +01:00
lukaszraczylo 3e885b5e7c Update checkout action to latest available.
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
2022-10-17 13:06:12 +01:00
lukaszraczylo 50282aa5f6 Fixup gomod and remove leftovers. 2022-10-17 13:04:02 +01:00
lukaszraczylo 5fa9728e0a Update dependencies to the latest available. 2022-10-17 13:00:38 +01:00
lukaszraczylo 084def2e9e Merge pull request #16 from lukaszraczylo/move-crossbuild
Change crossbuild to go-release-binaries.
2022-10-17 04:55:15 -07:00
lukaszraczylo 43b49666b6 Change crossbuild to go-release-binaries.
Reason: crossbuild action is deprecated and does not support current
latest versions of golang.
2022-10-17 12:49:07 +01:00
lukaszraczylo a89c69dda8 Update dependencies :) 2022-09-30 16:59:41 +01:00
lukaszraczylo 33ec1c7ce4 fixup! Update dependencies. 2022-05-28 00:59:49 +01:00
lukaszraczylo abb1152ec7 Update dependencies. 2022-05-28 00:51:30 +01:00
lukaszraczylo 1bcccf227e fixup! fixup! fixup! Update dependencies. 2022-05-27 22:37:00 +01:00
lukaszraczylo 9c355d1267 fixup! fixup! Update dependencies. 2022-05-27 22:27:48 +01:00
lukaszraczylo 821454583e fixup! Update dependencies. 2022-05-27 22:15:49 +01:00
lukaszraczylo ba588a0c6f Update dependencies. 2022-05-27 22:07:55 +01:00
lukaszraczylo 47546fca4f fixup! fixup! fixup! Update dependencies. 2022-05-05 10:00:01 +01:00
lukaszraczylo 8a6b6d48e6 fixup! fixup! Update dependencies. 2022-05-05 09:35:18 +01:00
lukaszraczylo fefb87c3d4 fixup! Update dependencies. 2022-05-05 09:26:19 +01:00
lukaszraczylo a5642b30e6 Update dependencies. 2022-05-05 09:18:21 +01:00
lukaszraczylo 9b03bb1566 fixup! Update dependencies. 2022-05-03 11:26:05 +01:00
lukaszraczylo 551e1b9d21 Update dependencies. 2022-04-29 12:25:20 +01:00
lukaszraczylo 58151695a3 Update dependencies. 2022-03-10 00:39:47 +00:00
lukaszraczylo 77616d4cdb fixup! Allow semver generator to run without configuration file present. 2022-03-10 00:28:20 +00:00
lukaszraczylo 4451f4b9b5 Allow semver generator to run without configuration file present. 2022-03-10 00:22:19 +00:00
lukaszraczylo 74b11f30c9 Update issue templates 2022-02-15 15:37:07 +00:00
lukaszraczylo 3a33815ea0 Clean previous release assets 2022-02-15 15:28:00 +00:00
lukaszraczylo 5878e650f7 Add missing interpretation of strict parameter from config file. 2022-02-10 16:22:13 +00:00
lukaszraczylo 559ed4ff59 Resolve issue with not parsing strict ( issue#13 ) 2022-02-10 16:01:30 +00:00
lukaszraczylo 93ea4e6365 Remove unnecessary print from ./semver-gen command 2022-02-10 15:15:36 +00:00
20 changed files with 777 additions and 1137 deletions
+20
View File
@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug, to be confirmed
assignees: lukaszraczylo
---
**Describe the bug**
A clear and concise description of what the bug is.
**Output with debug**
[ paste output of the command with `-d` flag here ]
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add any other context about the problem here.
+11
View File
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+74
View File
@@ -0,0 +1,74 @@
name: Autoupdate go.mod and go.sum
on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *"
env:
GO_VERSION: ">=1.21"
jobs:
# This job is responsible for preparation of the build
# environment variables.
prepare:
name: Preparing build context
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
id: cache
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- name: Go get dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
go get ./...
# This job is responsible for running tests and linting the codebase
test:
name: "Unit testing"
runs-on: ubuntu-latest
container: golang:1
needs: [prepare]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history is checked out
token: ${{ secrets.GHCR_TOKEN }}
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- name: Install dependencies
run: |
apt-get update
apt-get install ca-certificates make -y
update-ca-certificates
go mod tidy
go get -u -v ./...
go mod tidy -v
- name: Run unit tests
run: |
export GITHUB_TOKEN=${{ secrets.GHCR_TOKEN }}
CI_RUN=${CI} make test
git config --global --add safe.directory /__w/semver-generator/semver-generator
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update go.mod and go.sum"
commit_options: "--no-verify --signoff"
file_pattern: "go.mod go.sum"
+88 -90
View File
@@ -6,6 +6,7 @@ on:
paths-ignore:
- '**.md'
- '**/release.yaml'
- 'action.yml'
branches:
- "master"
- "main"
@@ -14,6 +15,7 @@ env:
ENABLE_CODE_LINT: false
ENABLE_CODE_SCANS: false
DEPLOY: false
GO_VERSION: 1.21
jobs:
prepare:
@@ -28,28 +30,29 @@ jobs:
RELEASE_VERSION: ${{ steps.get_env.outputs.RELEASE_VERSION }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Setting environment variables
id: get_env
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lukaszraczylo/semver-generator/releases/latest \
| grep browser_download_url \
| grep semver-gen-linux-amd64 \
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lukaszraczylo/semver-generator/releases/latest | grep -E ".*browser_download_url.*linux-" | grep -vE "(arm64|md5)" \
| cut -d '"' -f 4)
curl -s -L -o semver-gen "$DOWNLOAD_URL" && chmod +x semver-gen
TMP_SANITISED_REPOSITORY_NAME=$(echo ${{ github.event.repository.name }} | sed -e 's|\.|-|g')
TMP_GITHUB_COMMITS_COUNT=$(git rev-list --count HEAD)
TMP_GITHUB_COUNT_NUMBER=$(echo ${GITHUB_RUN_NUMBER})
TMP_RELEASE_VERSION=$(./semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g')
TMP_RELEASE_VERSION=1.4.3
echo "::set-output name=SANITISED_REPOSITORY_NAME::$TMP_SANITISED_REPOSITORY_NAME"
echo "::set-output name=DOCKER_IMAGE::ghcr.io/${{ github.repository_owner }}/$TMP_SANITISED_REPOSITORY_NAME"
echo "::set-output name=GITHUB_COMMIT_NUMBER::$TMP_GITHUB_COMMITS_COUNT"
echo "::set-output name=GITHUB_SHA::$(echo ${GITHUB_SHA::8})"
echo "::set-output name=GITHUB_RUN_ID::$TMP_GITHUB_COUNT_NUMBER"
echo "::set-output name=RELEASE_VERSION::$TMP_RELEASE_VERSION"
echo ">> Release version: $TMP_RELEASE_VERSION <<"
# Setting outputs
echo "SANITISED_REPOSITORY_NAME=$TMP_SANITISED_REPOSITORY_NAME" > $GITHUB_OUTPUT
echo "DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/$TMP_SANITISED_REPOSITORY_NAME" >> $GITHUB_OUTPUT
echo "GITHUB_COMMIT_NUMBER=$TMP_GITHUB_COMMITS_COUNT" >> $GITHUB_OUTPUT
echo "GITHUB_SHA=$(echo ${GITHUB_SHA::8})" >> $GITHUB_OUTPUT
echo "GITHUB_RUN_ID=$TMP_GITHUB_COUNT_NUMBER" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$TMP_RELEASE_VERSION" >> $GITHUB_OUTPUT
test:
needs: [ prepare ]
@@ -60,7 +63,11 @@ jobs:
CI: true
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Lint Code Base
if: env.ENABLE_CODE_LINT == true
env:
@@ -79,11 +86,12 @@ jobs:
run: |
make test CI_RUN=${CI}
- name: Upload codecov result
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: coverage.out
fail_ci_if_error: false
code_scans:
needs: [ prepare ]
@@ -91,7 +99,11 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Configure git for private modules
run: |
make update
@@ -106,20 +118,70 @@ jobs:
with:
args: ./...
build:
build-binary:
needs: [ prepare, test, code_scans ]
name: Docker image build (regular:multiarch)
name: Binary compilation and release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Build binaries
run: |
LOCAL_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }} make dist-release
- name: Get list of the commits since last release
run: |
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
- name: Create release [semver]
uses: ncipollo/release-action@v1
with:
bodyFile: ./.release_notes
name: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
token: ${{ secrets.GHCR_TOKEN }}
tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
artifacts: "dist/*"
allowUpdates: true
- name: Delete existing v1 tag and release
run: |
gh release delete v1 --cleanup-tag -y
env:
GH_TOKEN: ${{ secrets.GHCR_TOKEN }}
- name: Create release [v1]
uses: ncipollo/release-action@v1
with:
bodyFile: ./.release_notes
name: v1 - ${{ needs.prepare.outputs.RELEASE_VERSION }}
token: ${{ secrets.GHCR_TOKEN }}
tag: v1
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
artifacts: "dist/*"
allowUpdates: true
makeLatest: false
build-docker:
needs: [ prepare, test, code_scans, build-binary ]
name: Docker image build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.ACTOR }}
@@ -128,23 +190,23 @@ jobs:
id: prep
run: |
if [ -z "${{ needs.prepare.outputs.RELEASE_VERSION }}" ]; then
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest"
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest,${{ needs.prepare.outputs.DOCKER_IMAGE }}:v1"
else
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest"
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest,${{ needs.prepare.outputs.DOCKER_IMAGE }}:v1"
fi
echo ::set-output name=tags::${TAGS}
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT
BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')
LABELS="org.opencontainers.image.revision=${{ needs.prepare.outputs.GITHUB_SHA }}"
LABELS="$LABELS,org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
LABELS="$LABELS,org.opencontainers.image.version=$VERSION"
LABELS="$LABELS,com.github.repo.branch=$BRANCH"
LABELS="$LABELS,com.github.repo.dockerfile=Dockerfile"
echo ::set-output name=labels::${LABELS}
echo "LABELS=$LABELS" >> $GITHUB_OUTPUT
BUILD_ARGS="BRANCH=$BRANCH"
echo ::set-output name=args::${BUILD_ARGS}
echo "args=$BUILD_ARGS" >> $GITHUB_OUTPUT
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/arm64,linux/amd64
@@ -158,67 +220,3 @@ jobs:
${{ steps.prep.outputs.args }}
labels: ${{ steps.prep.outputs.labels }}
no-cache: false
- name: Scan image
uses: anchore/scan-action@v2
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
with:
image: "${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }}"
fail-build: true
build-binary:
needs: [ prepare, test, code_scans ]
name: Binary compilation and release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Compile binary
uses: thatisuday/go-cross-build@v1.0.2
with:
platforms: linux/amd64,darwin/amd64,windows/amd64,linux/arm64,darwin/amd64,darwin/arm64
name: semver-gen
package: ./
compress: false
dest: dist
ldflags: -s -w -X main.PKG_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }}
- name: Get list of the commits since last release
run: |
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
- name: Create Release
id: create_release
uses: marvinpinto/action-automatic-releases@latest
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: dist/semver-gen-*
automatic_release_tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
title: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
# tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
# name: ${{ needs.prepare.outputs.RELEASE_VERSION }}
# body_path: .release_notes
# draft: false
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
# - name: Delete previous v1 release asset
# uses: mknejp/delete-release-assets@v1
# with:
# token: ${{ github.token }}
# fail-if-no-assets: false
# fail-if-no-release: false
# tag: v1
# assets: 'semver-gen-*'
- name: Create Release V1
id: create_release_global
uses: marvinpinto/action-automatic-releases@latest
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: dist/semver-gen-*
automatic_release_tag: v1
title: version v1:${{ needs.prepare.outputs.RELEASE_VERSION }}
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
+3 -1
View File
@@ -1,2 +1,4 @@
semver-gen
coverage.out
coverage.out
.vscode
.DS_Store
+5 -12
View File
@@ -1,17 +1,10 @@
# syntax=docker/dockerfile:1.2.1-labs
FROM golang:1-alpine as baseimg
RUN apk add make
FROM golang:1-bullseye as baseimg
WORKDIR /go/src/app
ENV GO111MODULE=on CGO_ENABLED=1 GOOS=linux
COPY . /go/src/app/
RUN make
RUN CGO_ENABLED=1 make build
FROM alpine:latest
RUN apk add --no-cache ca-certificates
WORKDIR /go/src/app
COPY --from=baseimg /go/src/app/semver-gen .
COPY --from=baseimg /go/src/app/config-release.yaml config.yaml
FROM ubuntu:jammy
COPY --from=baseimg /go/src/app/semver-gen /go/src/app/semver-gen
COPY --from=baseimg /go/src/app/config-release.yaml /go/src/app/config.yaml
COPY --from=baseimg /go/src/app/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+37 -7
View File
@@ -1,21 +1,51 @@
LOCAL_VERSION?=$(shell semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g')
LOCAL_VERSION?=""
CI_RUN?=false
ADDITIONAL_BUILD_FLAGS=""
LDFLAGS=-s -w -X main.PKG_VERSION=${LOCAL_VERSION}
ifeq ($(CI_RUN), true)
ADDITIONAL_BUILD_FLAGS="-test.short"
endif
all: build
ifneq ($(shell which semver-gen), "")
LOCAL_VERSION="0.0.0-dev"
else
LOCAL_VERSION=$(shell semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g')
endif
build:
.PHONY: help
help: ## display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
.PHONY: all
all: build ## Build all targets
.PHONY: build
build: ## Build binary
go build -o semver-gen -ldflags="-s -w -X main.PKG_VERSION=${LOCAL_VERSION}" *.go
run: build
@./semver-gen
# .PHONY: run
# run: build ## Build binary and execute it
# @./semver-gen
test:
.PHONY: test
test: ## Run whole test suite
@go test ./... $(ADDITIONAL_BUILD_FLAGS) -v -race -cover -coverprofile=coverage.out
update:
.PHONY: update
update: ## Update dependencies
@go get -u ./...
@go mod tidy
.PHONY: update-all
update-all: ## Update all dependencies and sub-packages
@go get -u ./...
dist-release: ## Build all binaries
rm -fr dist/ || true
mkdir -p dist/
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -a -installsuffix cgo -o dist/semver-gen-linux-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -a -installsuffix cgo -o dist/semver-gen-linux-arm64
CGO_ENABLED=0 GOOS=darwin go build -ldflags="$(LDFLAGS)" -a -installsuffix cgo -o dist/semver-gen-darwin-amd64
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -a -installsuffix cgo -o dist/semver-gen-darwin-arm64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -a -installsuffix cgo -o dist/semver-gen-windows-amd64.exe
+7 -3
View File
@@ -13,8 +13,8 @@ Project created overnight, to prove that management of semantic versioning is NO
- [As a binary](#as-a-binary)
- [As a github action](#as-a-github-action)
- [As a docker container](#as-a-docker-container)
- [Calculations example [standard]](#calculations-example-standard)
- [Calculations example [strict matching]](#calculations-example-strict-matching)
- [Calculations example \[standard\]](#calculations-example-standard)
- [Calculations example \[strict matching\]](#calculations-example-strict-matching)
- [Release candidates](#release-candidates)
- [Example configuration](#example-configuration)
- [Good to know](#good-to-know)
@@ -78,6 +78,7 @@ Flags:
-h, --help help for semver-gen
-l, --local Use local repository
-r, --repository string Remote repository URL. (default "https://github.com/lukaszraczylo/simple-gql-client")
-b, --branch string Remote repository URL Branch. (default "main")
-s, --strict Strict matching
-u, --update Update binary with latest
-v, --version Display version
@@ -111,6 +112,8 @@ jobs:
# when using remote repository, especially with private one:
github_username: lukaszraczylo
github_token: MySupeRSecr3tPa$$w0rd
strict: true
existing: false
- name: Semver check
run: |
echo "Semantic version detected: ${{ steps.semver.outputs.semantic_version }}"
@@ -192,4 +195,5 @@ wording:
### Good to know
* Word matching uses fuzzy search AND is case INSENSITIVE
* I do not recommend using common words ( like "the" from the example configuration )
* I do not recommend using common words ( like "the" from the example configuration )
* You can specify env variable `LOG_LEVEL=debug` to see what exactly happens during the calculations
+20 -11
View File
@@ -1,30 +1,39 @@
# action.yml
name: 'Semantic Version Generator'
description: 'Automagic semantic version generator'
name: "Semantic Version Generator"
description: "Automagic semantic version generator"
author: Lukasz Raczylo
branding:
icon: chevron-right
color: gray-dark
inputs:
config_file:
description: 'Configuration file'
description: "Configuration file"
required: false
repository_url:
description: 'Repository URL'
description: "Repository URL"
required: false
default: 'https://github.com/lukaszraczylo/simple-gql-client'
default: "https://github.com/lukaszraczylo/simple-gql-client"
repository_local:
description: 'Use already cloned repository in current directory'
description: "Use already cloned repository in current directory"
required: false
github_token:
description: 'GitHub Personal Access Token OR password'
description: "GitHub Personal Access Token OR password"
required: false
github_username:
description: 'GitHub or other git hosting provider username'
description: "GitHub or other git hosting provider username"
required: false
strict:
description: "Strict mode"
required: false
existing:
description: "Respect existing tags"
required: false
debugmode:
description: "Debug mode"
required: false
outputs:
semantic_version:
description: 'Calculated semantic version'
description: "Calculated semantic version"
runs:
using: 'docker'
image: Dockerfile
using: "docker"
image: "docker://ghcr.io/lukaszraczylo/semver-generator:latest"
+22 -19
View File
@@ -6,18 +6,22 @@ import (
"os"
"runtime"
"github.com/lukaszraczylo/ask"
graphql "github.com/lukaszraczylo/go-simple-graphql"
libpack_logger "github.com/lukaszraczylo/graphql-monitoring-proxy/logging"
"github.com/melbahja/got"
"github.com/tidwall/gjson"
)
func updatePackage() bool {
ghToken, ghTokenSet := os.LookupEnv("GITHUB_TOKEN")
if ghTokenSet {
binaryName := fmt.Sprintf("semver-gen-%s-%s", runtime.GOOS, runtime.GOARCH)
fmt.Println("Downloading", binaryName)
logger.Info(&libpack_logger.LogMessage{Message: "Checking for updates", Pairs: map[string]interface{}{"binaryName": binaryName}})
gql := graphql.NewConnection()
gql.Endpoint = "https://api.github.com/graphql"
gql.SetEndpoint("https://api.github.com/graphql")
gql.SetOutput("mapstring")
headers := map[string]interface{}{
"Authorization": fmt.Sprintf("Bearer %s", ghToken),
}
@@ -40,36 +44,36 @@ func updatePackage() bool {
}`
result, err := gql.Query(query, variables, headers)
if err != nil {
fmt.Println("Query error", err)
logger.Error(&libpack_logger.LogMessage{Message: "Unable to query GitHub API", Pairs: map[string]interface{}{"error": err.Error()}})
return false
}
result = gjson.Get(result, "repository.latestRelease.releaseAssets.edges.0.node.downloadUrl").String()
if result == "" {
fmt.Println("Unable to obtain download url for the binary", binaryName)
output, ok := ask.For(result, "repository.latestRelease.releaseAssets.edges[0].node.downloadUrl").String("")
if !ok {
logger.Error(&libpack_logger.LogMessage{Message: "Unable to obtain download url for the binary", Pairs: map[string]interface{}{"binary": binaryName, "output": output}})
return false
}
if flag.Lookup("test.v") == nil && os.Getenv("CI") == "" {
downloadedBinaryPath := fmt.Sprintf("/tmp/%s", binaryName)
g := got.New()
err = g.Download(result, downloadedBinaryPath)
err = g.Download(output, downloadedBinaryPath)
if err != nil {
fmt.Println("Unable to download binary", err.Error())
logger.Error(&libpack_logger.LogMessage{Message: "Unable to download binary", Pairs: map[string]interface{}{"error": err.Error(), "binaryPath": downloadedBinaryPath}})
return false
}
currentBinary, err := os.Executable()
if err != nil {
fmt.Println("Unable to obtain current binary path", err.Error())
logger.Error(&libpack_logger.LogMessage{Message: "Unable to obtain current binary path", Pairs: map[string]interface{}{"error": err.Error()}})
return false
}
err = os.Rename(downloadedBinaryPath, currentBinary)
if err != nil {
fmt.Println("Unable to overwrite current binary", err.Error())
logger.Error(&libpack_logger.LogMessage{Message: "Unable to overwrite current binary", Pairs: map[string]interface{}{"error": err.Error()}})
return false
}
err = os.Chmod(currentBinary, 0777)
if err != nil {
fmt.Println("Unable to make binary executable", err.Error())
logger.Error(&libpack_logger.LogMessage{Message: "Unable to make binary executable", Pairs: map[string]interface{}{"error": err.Error()}})
return false
}
}
@@ -81,7 +85,7 @@ func checkLatestRelease() (string, bool) {
ghToken, ghTokenSet := os.LookupEnv("GITHUB_TOKEN")
if ghTokenSet {
gql := graphql.NewConnection()
gql.Endpoint = "https://api.github.com/graphql"
gql.SetEndpoint("https://api.github.com/graphql")
headers := map[string]interface{}{
"Authorization": fmt.Sprintf("bearer %s", ghToken),
}
@@ -99,15 +103,14 @@ func checkLatestRelease() (string, bool) {
}`
result, err := gql.Query(query, variables, headers)
if err != nil {
fmt.Println("Query error >>", err)
logger.Error(&libpack_logger.LogMessage{Message: "Unable to query GitHub API", Pairs: map[string]interface{}{"error": err.Error()}})
return "", false
}
fmt.Println(result)
result = gjson.Get(result, "repository.releases.nodes.0.tag.name").String()
if result == "v1" {
result = gjson.Get(result, "repository.releases.nodes.1.tag.name").String()
output, _ := ask.For(result, "repository.releases.nodes[0].tag.name").String("")
if output == "v1" {
output, _ = ask.For(result, "repository.releases.nodes[1].tag.name").String("")
}
return result, true
return output, true
} else {
return "[no GITHUB_TOKEN set]", false
}
+4
View File
@@ -2,9 +2,12 @@ package cmd
import (
"testing"
libpack_logging "github.com/lukaszraczylo/graphql-monitoring-proxy/logging"
)
func Test_checkLatestRelease(t *testing.T) {
logger = libpack_logging.New()
tests := []struct {
name string
want string
@@ -26,6 +29,7 @@ func Test_checkLatestRelease(t *testing.T) {
}
func Test_updatePackage(t *testing.T) {
logger = libpack_logging.New()
if testing.Short() {
t.Skip("Skipping test in short / CI mode")
}
+123 -46
View File
@@ -1,3 +1,4 @@
// Project: semver-generator
/*
Copyright © 2021 LUKASZ RACZYLO <lukasz$raczylo,com>
@@ -17,7 +18,6 @@ limitations under the License.
package cmd
import (
"flag"
"fmt"
"net/url"
"os"
@@ -32,6 +32,7 @@ import (
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/lithammer/fuzzysearch/fuzzy"
libpack_logger "github.com/lukaszraczylo/graphql-monitoring-proxy/logging"
"github.com/lukaszraczylo/pandati"
"github.com/spf13/viper"
)
@@ -40,6 +41,7 @@ var (
err error
repo *Setup
PKG_VERSION string
logger *libpack_logger.Logger
)
type Wording struct {
@@ -50,11 +52,12 @@ type Wording struct {
}
type Force struct {
Commit string
Patch int
Minor int
Major int
Commit string
Existing bool
Strict bool
}
type SemVer struct {
@@ -66,24 +69,25 @@ type SemVer struct {
}
type Setup struct {
RepositoryName string
RepositoryLocalPath string
RepositoryHandler *git.Repository
RepositoryName string
RepositoryBranch string
RepositoryLocalPath string
LocalConfigFile string
Wording Wording
Commits []CommitDetails
Tags []TagDetails
Semver SemVer
Wording Wording
Force Force
Semver SemVer
Generate bool
LocalConfigFile string
UseLocal bool
}
type CommitDetails struct {
Timestamp time.Time
Hash string
Author string
Message string
Timestamp time.Time
}
type TagDetails struct {
@@ -93,31 +97,42 @@ type TagDetails struct {
func checkMatches(content []string, targets []string) bool {
if fuzzy.MatchNormalizedFold(strings.Join(content, " "), "Merge branch") {
debugPrint(fmt.Sprintln("Merge detected, ignoring commits within:", content))
logger.Debug(&libpack_logger.LogMessage{
Message: "Merge detected, ignoring commits within",
Pairs: map[string]interface{}{"content": strings.Join(content, " ")},
})
return false
}
var r []string
for _, tgt := range targets {
r = fuzzy.FindNormalizedFold(tgt, content)
if len(r) > 0 {
debugPrint(fmt.Sprintln("Found match for ", tgt, "|", strings.Join(r, ",")))
logger.Debug(&libpack_logger.LogMessage{
Message: "Found match",
Pairs: map[string]interface{}{"target": tgt, "match": strings.Join(r, ","), "content": strings.Join(content, " ")},
})
return true
}
}
return false
}
func debugPrint(content string) {
if params.varDebug && flag.Lookup("test.v") == nil {
fmt.Println("DEBUG:", content)
}
}
var extractNumber = regexp.MustCompile("[0-9]+")
func parseExistingSemver(tagName string) (semanticVersion SemVer) {
func parseExistingSemver(tagName string, currentSemver SemVer) (semanticVersion SemVer) {
logger.Debug(&libpack_logger.LogMessage{
Message: "Parsing existing semver",
Pairs: map[string]interface{}{"tag": tagName},
})
var tagNameParts []string
tagNameParts = strings.Split(tagName, ".")
if len(tagNameParts) < 3 {
logger.Debug(&libpack_logger.LogMessage{
Message: "Unable to parse incompatible semver ( non x.y.z )",
Pairs: map[string]interface{}{"tag": tagName},
})
return currentSemver
}
semanticVersion.Major, _ = strconv.Atoi(extractNumber.FindAllString(tagNameParts[0], -1)[0])
semanticVersion.Minor, _ = strconv.Atoi(extractNumber.FindAllString(tagNameParts[1], -1)[0])
semanticVersion.Patch, _ = strconv.Atoi(extractNumber.FindAllString(tagNameParts[2], -1)[0])
@@ -133,16 +148,22 @@ func (s *Setup) CalculateSemver() SemVer {
if params.varExisting || s.Force.Existing {
for _, tagHash := range s.Tags {
if commit.Hash == tagHash.Hash {
debugPrint(fmt.Sprintln("Found existing tag:", tagHash.Name, "related to", commit.Message))
s.Semver = parseExistingSemver(tagHash.Name)
logger.Debug(&libpack_logger.LogMessage{
Message: "Found existing tag",
Pairs: map[string]interface{}{"tag": tagHash.Name, "commit": strings.TrimSuffix(commit.Message, "\n")},
})
s.Semver = parseExistingSemver(tagHash.Name, s.Semver)
continue
}
}
}
if !params.varStrict {
if !params.varStrict && !s.Force.Strict {
s.Semver.Patch++
debugPrint(fmt.Sprintln("Incrementing patch (DEFAULT) on ", strings.TrimSuffix(commit.Message, "\n"), "| Semver:", s.getSemver()))
logger.Debug(&libpack_logger.LogMessage{
Message: "Incrementing patch (DEFAULT)",
Pairs: map[string]interface{}{"commit": strings.TrimSuffix(commit.Message, "\n"), "semver": s.getSemver()},
})
}
commitSlice := strings.Fields(commit.Message)
matchPatch := checkMatches(commitSlice, s.Wording.Patch)
@@ -151,14 +172,20 @@ func (s *Setup) CalculateSemver() SemVer {
matchReleaseCandidate := checkMatches(commitSlice, s.Wording.Release)
if matchPatch {
s.Semver.Patch++
debugPrint(fmt.Sprintln("Incrementing patch (WORDING) on ", strings.TrimSuffix(commit.Message, "\n"), "| Semver:", s.getSemver()))
logger.Debug(&libpack_logger.LogMessage{
Message: "Incrementing patch (WORDING)",
Pairs: map[string]interface{}{"commit": strings.TrimSuffix(commit.Message, "\n"), "semver": s.getSemver()},
})
continue
}
if matchReleaseCandidate {
s.Semver.Release++
s.Semver.Patch = 1
s.Semver.EnableReleaseCandidate = true
debugPrint(fmt.Sprintln("Incrementing release candidate (WORDING) on ", strings.TrimSuffix(commit.Message, "\n"), "| Semver:", s.getSemver()))
logger.Debug(&libpack_logger.LogMessage{
Message: "Incrementing release candidate (WORDING)",
Pairs: map[string]interface{}{"commit": strings.TrimSuffix(commit.Message, "\n"), "semver": s.getSemver()},
})
continue
}
if matchMinor {
@@ -166,7 +193,10 @@ func (s *Setup) CalculateSemver() SemVer {
s.Semver.Patch = 1
s.Semver.EnableReleaseCandidate = false
s.Semver.Release = 0
debugPrint(fmt.Sprintln("Incrementing minor (WORDING) on ", strings.TrimSuffix(commit.Message, "\n"), "| Semver:", s.getSemver()))
logger.Debug(&libpack_logger.LogMessage{
Message: "Incrementing minor (WORDING)",
Pairs: map[string]interface{}{"commit": strings.TrimSuffix(commit.Message, "\n"), "semver": s.getSemver()},
})
continue
}
if matchMajor {
@@ -175,7 +205,10 @@ func (s *Setup) CalculateSemver() SemVer {
s.Semver.Patch = 1
s.Semver.EnableReleaseCandidate = false
s.Semver.Release = 0
debugPrint(fmt.Sprintln("Incrementing major (WORDING) on ", strings.TrimSuffix(commit.Message, "\n"), "| Semver:", s.getSemver()))
logger.Debug(&libpack_logger.LogMessage{
Message: "Incrementing major (WORDING)",
Pairs: map[string]interface{}{"commit": strings.TrimSuffix(commit.Message, "\n"), "semver": s.getSemver()},
})
continue
}
}
@@ -183,14 +216,19 @@ func (s *Setup) CalculateSemver() SemVer {
}
func (s *Setup) ListExistingTags() {
debugPrint(fmt.Sprintln("Listing existing tags"))
logger.Debug(&libpack_logger.LogMessage{
Message: "Listing existing tags",
})
refs, err := s.RepositoryHandler.Tags()
if err != nil {
panic(err)
}
if err := refs.ForEach(func(ref *plumbing.Reference) error {
s.Tags = append(s.Tags, TagDetails{Name: ref.Name().Short(), Hash: ref.Hash().String()})
debugPrint(fmt.Sprintln("Found tag:", ref.Name().Short(), ref.Hash().String()))
logger.Debug(&libpack_logger.LogMessage{
Message: "Found tag",
Pairs: map[string]interface{}{"tag": ref.Name().Short(), "hash": ref.Hash().String()},
})
return nil
}); err != nil {
panic(err)
@@ -217,11 +255,16 @@ func (s *Setup) ListCommits() ([]CommitDetails, error) {
return nil
})
debugPrint(fmt.Sprintln("\n---COMMITS BEFORE CUT---\n", s.Commits))
logger.Debug(&libpack_logger.LogMessage{
Message: "Listing commits",
Pairs: map[string]interface{}{"commits": tmpResults},
})
for commitId, cmt := range tmpResults {
if s.Force.Commit != "" && cmt.Hash == s.Force.Commit {
debugPrint(fmt.Sprintln(">>>> FOUND MATCH", len(s.Commits), len(tmpResults[commitId:])))
logger.Debug(&libpack_logger.LogMessage{
Message: "Found commit match",
Pairs: map[string]interface{}{"commit": cmt.Hash, "index": commitId},
})
s.Commits = tmpResults[commitId:]
break
} else {
@@ -229,7 +272,10 @@ func (s *Setup) ListCommits() ([]CommitDetails, error) {
}
}
debugPrint(fmt.Sprintln("\n---COMMITS AFTER CUT---\n", s.Commits))
logger.Debug(&libpack_logger.LogMessage{
Message: "Commits after cut",
Pairs: map[string]interface{}{"commits": s.Commits},
})
return s.Commits, err
}
@@ -237,13 +283,18 @@ func (s *Setup) Prepare() error {
if !repo.UseLocal {
u, err := url.Parse(s.RepositoryName)
if err != nil {
fmt.Println("Unable to parse repository URL", s.RepositoryName, "Error:", err.Error())
logger.Error(&libpack_logger.LogMessage{
Message: "Unable to parse repository URL",
Pairs: map[string]interface{}{"error": err.Error(), "url": s.RepositoryName},
})
return err
}
s.RepositoryLocalPath = fmt.Sprintf("/tmp/semver/%s", u.Path)
s.RepositoryLocalPath = fmt.Sprintf("/tmp/semver/%s/%s", u.Path, s.RepositoryBranch)
os.RemoveAll(s.RepositoryLocalPath)
s.RepositoryHandler, err = git.PlainClone(s.RepositoryLocalPath, false, &git.CloneOptions{
URL: s.RepositoryName,
URL: s.RepositoryName,
ReferenceName: plumbing.NewBranchReferenceName(s.RepositoryBranch),
SingleBranch: true,
Auth: &http.BasicAuth{
Username: os.Getenv("GITHUB_USERNAME"),
Password: os.Getenv("GITHUB_TOKEN"),
@@ -251,14 +302,20 @@ func (s *Setup) Prepare() error {
Tags: git.AllTags,
})
if err != nil {
fmt.Println("Unable to reach repository", s.RepositoryName, "Error:", err.Error())
logger.Error(&libpack_logger.LogMessage{
Message: "Unable to clone repository",
Pairs: map[string]interface{}{"error": err.Error(), "url": s.RepositoryName},
})
return err
}
} else {
s.RepositoryLocalPath = "./"
s.RepositoryHandler, err = git.PlainOpen(s.RepositoryLocalPath)
if err != nil {
fmt.Println("Unable to reach repository", s.RepositoryName, "Error:", err.Error())
logger.Error(&libpack_logger.LogMessage{
Message: "Unable to open local repository",
Pairs: map[string]interface{}{"error": err.Error(), "path": s.RepositoryLocalPath},
})
return err
}
}
@@ -268,15 +325,24 @@ func (s *Setup) Prepare() error {
func (s *Setup) ForcedVersioning() {
if !pandati.IsZero(s.Force.Major) {
debugPrint(fmt.Sprintln("Forced versioning (MAJOR)", s.Force.Major))
logger.Debug(&libpack_logger.LogMessage{
Message: "Forced versioning (MAJOR)",
Pairs: map[string]interface{}{"major": s.Force.Major},
})
s.Semver.Major = s.Force.Major
}
if !pandati.IsZero(s.Force.Minor) {
debugPrint(fmt.Sprintln("Forced versioning (MINOR)", s.Force.Minor))
logger.Debug(&libpack_logger.LogMessage{
Message: "Forced versioning (MINOR)",
Pairs: map[string]interface{}{"minor": s.Force.Minor},
})
s.Semver.Minor = s.Force.Minor
}
if !pandati.IsZero(s.Force.Patch) {
debugPrint(fmt.Sprintln("Forced versioning (PATCH)", s.Force.Patch))
logger.Debug(&libpack_logger.LogMessage{
Message: "Forced versioning (PATCH)",
Pairs: map[string]interface{}{"patch": s.Force.Minor},
})
s.Semver.Patch = s.Force.Patch
}
}
@@ -302,15 +368,22 @@ func (s *Setup) getSemver() (semverReturned string) {
}
func main() {
logger = libpack_logger.New()
if params.varShowVersion {
var outdatedMsg string
latestRelease, latestRelaseOk := checkLatestRelease()
if PKG_VERSION != latestRelease && latestRelaseOk {
outdatedMsg = fmt.Sprintf("(Latest available: %s)", latestRelease)
}
fmt.Println("semver-gen", PKG_VERSION, "", outdatedMsg, "\tMore information: https://github.com/lukaszraczylo/semver-generator")
logger.Info(&libpack_logger.LogMessage{
Message: "semver-gen",
Pairs: map[string]interface{}{"version": PKG_VERSION, "outdated": outdatedMsg},
})
if outdatedMsg != "" {
fmt.Println("You can update automatically with: semver-gen -u")
logger.Info(&libpack_logger.LogMessage{
Message: "semver-gen",
Pairs: map[string]interface{}{"message": "You can update automatically with: semver-gen -u"},
})
}
return
}
@@ -321,16 +394,20 @@ func main() {
if repo.Generate || params.varGenerateInTest {
err := repo.ReadConfig(repo.LocalConfigFile)
if err != nil {
fmt.Println("Unable to find config file", repo.LocalConfigFile)
os.Exit(1)
logger.Error(&libpack_logger.LogMessage{
Message: "Unable to find config file semver.yaml. Using defaults and flags.",
Pairs: map[string]interface{}{"file": repo.LocalConfigFile},
})
}
err = repo.Prepare()
if err != nil {
fmt.Println("Unable to prepare repository")
os.Exit(1)
logger.Critical(&libpack_logger.LogMessage{
Message: "Unable to prepare repository",
Pairs: map[string]interface{}{"error": err.Error()},
})
}
repo.ListCommits()
if params.varExisting {
if params.varExisting || repo.Force.Existing {
repo.ListExistingTags()
}
repo.ForcedVersioning()
+90 -37
View File
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,6 +21,7 @@ import (
"testing"
git "github.com/go-git/go-git/v5"
libpack_logging "github.com/lukaszraczylo/graphql-monitoring-proxy/logging"
"github.com/lukaszraczylo/pandati"
assertions "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
@@ -36,12 +37,17 @@ var (
)
func (suite *Tests) SetupTest() {
os.Chdir(testCurrentPath)
err := os.Chdir(testCurrentPath)
if err != nil {
logger.Critical(&libpack_logging.LogMessage{Message: "Unable to change directory to test directory", Pairs: map[string]any{"error": err}})
}
assert = assertions.New(suite.T())
params.varDebug = true
params.varRepoBranch = "main"
}
func TestSuite(t *testing.T) {
logger = libpack_logging.New()
testCurrentPath, _ = os.Getwd()
suite.Run(t, new(Tests))
}
@@ -52,8 +58,8 @@ func (suite *Tests) TestSetup_getSemver() {
}
tests := []struct {
name string
fields fields
want string
fields fields
}{
{
name: "Return 1.3.7",
@@ -106,13 +112,13 @@ func (suite *Tests) TestSetup_getSemver() {
func (suite *Tests) TestSetup_ForcedVersioning() {
type fields struct {
Semver SemVer
Force Force
Semver SemVer
}
tests := []struct {
name string
fields fields
want string
fields fields
}{
{
name: "No versioning",
@@ -211,8 +217,8 @@ func (suite *Tests) TestSetup_ReadConfig() {
}
tests := []struct {
name string
fields fields
args args
fields fields
wordingEmpty bool
wantErr bool
}{
@@ -284,14 +290,15 @@ func (suite *Tests) Test_checkMatches() {
func (suite *Tests) TestSetup_ListCommits() {
type fields struct {
RepositoryName string
RepositoryLocalPath string
RepositoryHandler *git.Repository
RepositoryName string
RepositoryBranch string
RepositoryLocalPath string
LocalConfigFile string
Commits []CommitDetails
Semver SemVer
Wording Wording
Commits []CommitDetails
Force Force
Semver SemVer
}
tests := []struct {
@@ -303,7 +310,8 @@ func (suite *Tests) TestSetup_ListCommits() {
{
name: "List commits from existing repository",
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client",
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client",
RepositoryBranch: "master",
},
noCommits: false,
wantErr: false,
@@ -311,7 +319,8 @@ func (suite *Tests) TestSetup_ListCommits() {
{
name: "List commits from non-existing repository",
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client-dead",
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client-dead",
RepositoryBranch: "main",
},
noCommits: true,
wantErr: true,
@@ -319,7 +328,8 @@ func (suite *Tests) TestSetup_ListCommits() {
{
name: "List commits starting with certain hash",
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client",
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client",
RepositoryBranch: "master",
Force: Force{
Commit: "f6ee82113afb32ee95eac892d1155582a2f85166",
},
@@ -333,6 +343,7 @@ func (suite *Tests) TestSetup_ListCommits() {
s := &Setup{}
s.ReadConfig(tt.fields.LocalConfigFile)
s.RepositoryName = tt.fields.RepositoryName
s.RepositoryBranch = tt.fields.RepositoryBranch
s.Force = tt.fields.Force
s.Prepare()
listOfCommits, err := s.ListCommits()
@@ -349,8 +360,9 @@ func (suite *Tests) TestSetup_ListCommits() {
func (suite *Tests) TestSetup_CalculateSemver() {
type fields struct {
RepositoryName string
Force Force
BranchName string
LocalConfigFile string
Force Force
}
type wantSemver struct {
Major int
@@ -368,6 +380,7 @@ func (suite *Tests) TestSetup_CalculateSemver() {
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/semver-generator-test-repo",
LocalConfigFile: "meta.yaml",
BranchName: "main",
},
strictMatching: false,
wantSemver: wantSemver{
@@ -381,6 +394,7 @@ func (suite *Tests) TestSetup_CalculateSemver() {
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/semver-generator-test-repo",
LocalConfigFile: "meta.yaml",
BranchName: "main",
},
strictMatching: true,
wantSemver: wantSemver{
@@ -394,6 +408,7 @@ func (suite *Tests) TestSetup_CalculateSemver() {
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/semver-generator-test-repo",
LocalConfigFile: "meta.yaml",
BranchName: "main",
Force: Force{
Major: 1,
Minor: 1,
@@ -412,6 +427,7 @@ func (suite *Tests) TestSetup_CalculateSemver() {
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/semver-generator-test-repo",
LocalConfigFile: "meta.yaml",
BranchName: "main",
Force: Force{
Major: 1,
Minor: 1,
@@ -442,6 +458,7 @@ func (suite *Tests) TestSetup_CalculateSemver() {
s := &Setup{}
s.ReadConfig(tt.fields.LocalConfigFile)
s.RepositoryName = tt.fields.RepositoryName
s.RepositoryBranch = tt.fields.BranchName
s.Prepare()
s.ForcedVersioning()
s.Force = tt.fields.Force
@@ -455,31 +472,10 @@ func (suite *Tests) TestSetup_CalculateSemver() {
}
}
func (suite *Tests) Test_debugPrint() {
type args struct {
content string
}
tests := []struct {
name string
args args
}{
{
name: "Test debug print",
args: args{
content: "Test debug",
},
},
}
for _, tt := range tests {
suite.T().Run(tt.name, func(t *testing.T) {
debugPrint(tt.args.content)
})
}
}
func (suite *Tests) Test_main() {
type vars struct {
varRepoName string
varRepoBranch string
varLocalCfg string
varUseLocal bool
varShowVersion bool
@@ -569,7 +565,11 @@ func (suite *Tests) Test_parseExistingSemver() {
}
for _, tt := range tests {
suite.T().Run(tt.name, func(t *testing.T) {
got := parseExistingSemver(tt.args.tagName)
got := parseExistingSemver(tt.args.tagName, SemVer{
Major: 1,
Minor: 1,
Patch: 1,
})
assert.Equal(tt.wantSemanticVersion.Major, got.Major, "Unexpected MAJOR semver result in "+tt.name)
assert.Equal(tt.wantSemanticVersion.Minor, got.Minor, "Unexpected MINOR semver result in "+tt.name)
assert.Equal(tt.wantSemanticVersion.Patch, got.Patch, "Unexpected PATCH semver result in "+tt.name)
@@ -577,3 +577,56 @@ func (suite *Tests) Test_parseExistingSemver() {
})
}
}
func (suite *Tests) TestSetup_ListExistingTags() {
type fields struct {
RepositoryHandler *git.Repository
RepositoryName string
RepositoryBranch string
RepositoryLocalPath string
LocalConfigFile string
Wording Wording
Commits []CommitDetails
Force Force
Semver SemVer
}
tests := []struct {
name string
fields fields
noTags bool
}{
{
name: "List tags from existing repository",
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client",
RepositoryBranch: "master",
},
noTags: false,
},
{
name: "List tags from non-existing repository",
fields: fields{
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client-dead",
RepositoryBranch: "master",
},
noTags: true,
},
}
for _, tt := range tests {
suite.T().Run(tt.name, func(t *testing.T) {
s := &Setup{}
s.ReadConfig(tt.fields.LocalConfigFile)
s.RepositoryName = tt.fields.RepositoryName
s.RepositoryBranch = tt.fields.RepositoryBranch
s.Force = tt.fields.Force
s.Prepare()
s.ListExistingTags()
if tt.noTags {
assert.Equal(len(s.Tags), 0, "Unexpected number of tags in "+tt.name)
} else {
assert.GreaterOrEqual(len(s.Tags), 1, "Unexpected number of tags in "+tt.name)
}
})
}
}
+7 -1
View File
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,6 +41,10 @@ func (r *Setup) setupCobra() {
if err != nil {
panic(err)
}
r.RepositoryBranch, err = rootCmd.Flags().GetString("branch")
if err != nil {
panic(err)
}
r.LocalConfigFile, err = rootCmd.Flags().GetString("config")
if err != nil {
panic(err)
@@ -53,6 +57,7 @@ func (r *Setup) setupCobra() {
type myParams struct {
varRepoName string
varRepoBranch string
varLocalCfg string
varUseLocal bool
varShowVersion bool
@@ -69,6 +74,7 @@ func init() {
repo = &Setup{}
cobra.OnInitialize(repo.setupCobra)
rootCmd.PersistentFlags().StringVarP(&params.varRepoName, "repository", "r", "https://github.com/lukaszraczylo/simple-gql-client", "Remote repository URL.")
rootCmd.PersistentFlags().StringVarP(&params.varRepoBranch, "branch", "b", "main", "Remote repository URL Branch.")
rootCmd.PersistentFlags().StringVarP(&params.varLocalCfg, "config", "c", "semver.yaml", "Path to config file")
rootCmd.PersistentFlags().BoolVarP(&params.varUseLocal, "local", "l", false, "Use local repository")
rootCmd.PersistentFlags().BoolVarP(&params.varShowVersion, "version", "v", false, "Display version")
+2
View File
@@ -3,6 +3,8 @@ force:
major: 1
minor: 4
existing: true
strict: false
commit: 960207e4677476ad31a9f389f74eaf9f33d49613
wording:
patch:
- update
+2 -1
View File
@@ -1,7 +1,8 @@
version: 1
force:
major: 1
existing: true
existing: false
strict: false
wording:
patch:
- update
+36 -6
View File
@@ -1,10 +1,11 @@
#!/bin/sh -l
set -o pipefail
#!/bin/bash
set -e
FLAGS=""
FLAGS="$SEMVER_RAW_FLAGS"
if [[ -z "$INPUT_CONFIG_FILE" ]]; then
echo "Set the configuration file path."
exit 1
else
FLAGS="${FLAGS} -c $INPUT_CONFIG_FILE"
fi
@@ -18,10 +19,26 @@ if [[ ! -z "$INPUT_REPOSITORY_URL" ]]; then
FLAGS="${FLAGS} -r $INPUT_REPOSITORY_URL"
fi
if [[ ! -z "$INPUT_REPOSITORY_BRANCH" ]]; then
FLAGS="${FLAGS} -b $INPUT_REPOSITORY_BRANCH"
fi
if [[ ! -z "$INPUT_REPOSITORY_LOCAL" ]]; then
FLAGS="${FLAGS} -l"
fi
if [[ ! -z "$INPUT_STRICT" ]]; then
FLAGS="${FLAGS} -s"
fi
if [[ ! -z "$INPUT_EXISTING" ]]; then
FLAGS="${FLAGS} -e"
fi
if [[ ! -z "$INPUT_DEBUGMODE" ]]; then
FLAGS="${FLAGS} --debug"
fi
if [[ "${FLAGS}" == "" && "$*" == "" ]]; then
exit 1
fi
@@ -34,8 +51,21 @@ if [[ ! -z "$INPUT_GITHUB_USERNAME" ]]; then
export GITHUB_USERNAME=$INPUT_GITHUB_USERNAME
fi
cd /github/workspace
if [[ ! -z "$INPUT_DEBUGMODE" ]]; then
echo "DEBUG MODE ENABLED"
echo "----"
ls -lA
echo "----"
pwd
echo "----"
echo "FLAGS: $FLAGS"
echo "----"
/go/src/app/semver-gen generate $FLAGS $*
echo "----"
fi
OUT_SEMVER_GEN=$(/go/src/app/semver-gen generate $FLAGS $*)
[ $? -eq 0 ] || exit 1
echo "::set-output name=semantic_version::$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g')"
echo $OUT_SEMVER_GEN
CLEAN_SEMVER=$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g')
echo "semantic_version=$CLEAN_SEMVER" >> $GITHUB_OUTPUT
echo $OUT_SEMVER_GEN
+60 -45
View File
@@ -1,58 +1,73 @@
module github.com/lukaszraczylo/semver-generator
go 1.17
go 1.22.4
require (
github.com/go-git/go-git/v5 v5.4.2
github.com/lithammer/fuzzysearch v1.1.3
github.com/lukaszraczylo/go-simple-graphql v1.0.50
github.com/lukaszraczylo/pandati v0.0.10
github.com/melbahja/got v0.6.1
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.7.0
github.com/tidwall/gjson v1.14.0
github.com/go-git/go-git/v5 v5.12.0
github.com/lithammer/fuzzysearch v1.1.8
github.com/lukaszraczylo/ask v0.0.0-20240916204100-6e9ef53a62d9
github.com/lukaszraczylo/go-simple-graphql v1.2.31
github.com/lukaszraczylo/graphql-monitoring-proxy v0.23.112
github.com/lukaszraczylo/pandati v0.0.29
github.com/melbahja/got v0.7.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
)
require (
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/allegro/bigcache/v3 v3.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.2 // indirect
github.com/avast/retry-go/v4 v4.6.0 // indirect
github.com/cloudflare/circl v1.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.3.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/gookit/goutil v0.6.17 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.1.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/zerolog v1.26.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spf13/afero v1.8.1 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
golang.org/x/crypto v0.0.0-20220209195652-db638375bc3a // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/wI2L/jsondiff v0.6.1 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+165 -857
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,