gfsm 0.1.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +17 -2
- data/Dockerfile +7 -0
- data/README.md +40 -3
- data/lib/commands/changelog.rb +6 -2
- data/lib/data/configuration.rb +1 -1
- data/lib/tools/commits_extractor.rb +1 -1
- data/lib/tools/current_version_loader.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e0ba6497503d24cc631e5a561879a5b8fddd9b0b98243b4b92d2f05f5add90
|
4
|
+
data.tar.gz: ac56fb2b77daf823e235cf7c06e6ca8ad29d585f261e83a90506efe7a3f30fd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99373328bcc6e18fa2bd4c588a98fca5ff359fa83c2f1281049236a23f5f8631aafb9676ab813461dd2a6b87a89a83a3b595cc81db9d7266f141d412ca0c8f61
|
7
|
+
data.tar.gz: 1928c819f0a3bc20d324cacfb038506ed6eaf0cacb425070bcd09c4f85ea65bde18374cd4029aa2808552b2e6a71f4e46169811a3404e034177f9c0c32a2ab66
|
data/.gitlab-ci.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
stages:
|
2
2
|
- version
|
3
3
|
- deploy
|
4
|
+
- docker
|
4
5
|
- release
|
5
6
|
|
6
7
|
workflow:
|
@@ -56,19 +57,33 @@ Publish gem:
|
|
56
57
|
when: never
|
57
58
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
58
59
|
|
60
|
+
Upload docker image:
|
61
|
+
stage: docker
|
62
|
+
image: docker:20.10.16
|
63
|
+
services:
|
64
|
+
- docker:20.10.16-dind
|
65
|
+
script:
|
66
|
+
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
67
|
+
- docker build -t $CI_REGISTRY/zille_marco/gitlab-flavored-semantic-versioning:latest -t $CI_REGISTRY/zille_marco/gitlab-flavored-semantic-versioning:v$RELEASE_VERSION .
|
68
|
+
- docker push --all-tags $CI_REGISTRY/zille_marco/gitlab-flavored-semantic-versioning
|
69
|
+
rules:
|
70
|
+
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
71
|
+
when: never
|
72
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
73
|
+
|
59
74
|
Create release:
|
60
75
|
stage: release
|
61
76
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
62
77
|
script:
|
63
78
|
- |
|
64
79
|
release-cli create --name "Release v$RELEASE_VERSION" --description CHANGELOG.md --tag-name "v$RELEASE_VERSION"
|
65
|
-
tags:
|
66
|
-
- unix
|
67
80
|
needs:
|
68
81
|
- job: "Update version"
|
69
82
|
artifacts: true
|
70
83
|
- job: "Publish gem"
|
71
84
|
artifacts: false
|
85
|
+
- job: "Upload docker image"
|
86
|
+
artifacts: false
|
72
87
|
rules:
|
73
88
|
- if: '$GEM_HOST_API_KEY == null'
|
74
89
|
when: never
|
data/Dockerfile
ADDED
data/README.md
CHANGED
@@ -56,8 +56,45 @@ At the moment there's no built-in testing platform, but I'm planning to use `rsp
|
|
56
56
|
|
57
57
|
### Using
|
58
58
|
|
59
|
-
|
59
|
+
This project is available as a Ruby gem, so to be able to use it is enough to run
|
60
60
|
|
61
61
|
```shell
|
62
|
-
|
63
|
-
```
|
62
|
+
gem install gfsm
|
63
|
+
```
|
64
|
+
|
65
|
+
Once that command completes, the gem will be available and you can invoke it from the command line with
|
66
|
+
|
67
|
+
```shell
|
68
|
+
gfsm help
|
69
|
+
```
|
70
|
+
|
71
|
+
The main way this project can be used though, is inside a CI pipeline where you can invoke it to bump the version and/or update the changelog.
|
72
|
+
|
73
|
+
In order to use is inside a CI job, the job itself could look something like this:
|
74
|
+
|
75
|
+
```yaml
|
76
|
+
stages:
|
77
|
+
- version
|
78
|
+
|
79
|
+
update-version:
|
80
|
+
stage: version
|
81
|
+
image: ruby:2.7.5
|
82
|
+
before_script:
|
83
|
+
- gem install gfsm
|
84
|
+
script:
|
85
|
+
- gfsm version bump --force > .version
|
86
|
+
- gfsm changelog --force --output-file CHANGELOG.md
|
87
|
+
- echo "RELEASE_VERSION=$(<.version)" >> variables.env
|
88
|
+
artifacts:
|
89
|
+
reports:
|
90
|
+
dotenv: variables.env
|
91
|
+
paths:
|
92
|
+
- .version
|
93
|
+
- CHANGELOG.md
|
94
|
+
```
|
95
|
+
|
96
|
+
With this, subsequent jobs that depend on the `update-version` job will:
|
97
|
+
- be able to get the new version form the `RELEASE_VERSION` environment variable
|
98
|
+
- read the `CHANGELOG.md` file to get an updated changelog file
|
99
|
+
|
100
|
+
To have a working example of the things described above you can have a look at the `.gitlab-ci.yml` of this project, which implements this exact concept.
|
data/lib/commands/changelog.rb
CHANGED
@@ -76,11 +76,15 @@ module GFSM
|
|
76
76
|
|
77
77
|
version_bumper = GFSM::Tools::VersionBumper.new()
|
78
78
|
version = version_bumper.compute_version!(force, prerelease, prerelease_name, repository_path, configuration_file_path)
|
79
|
-
subdivisions = version_bumper.subdivisions
|
79
|
+
subdivisions = version_bumper.subdivisions.to_a
|
80
|
+
subdivisions.sort_by! { |subdivision_data| subdivision_data[0].priority }.reverse!
|
80
81
|
|
81
82
|
changelog_entries = ""
|
82
83
|
|
83
|
-
subdivisions.each do |
|
84
|
+
subdivisions.each do |subdivision_data|
|
85
|
+
change_type = subdivision_data[0]
|
86
|
+
commits = subdivision_data[1]
|
87
|
+
|
84
88
|
changelog_entries += "\n#{change_type.to_changelog_entry}\n\n"
|
85
89
|
|
86
90
|
commits.each do |commit|
|
data/lib/data/configuration.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gfsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zille Marco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- ".gitlab-ci.yml"
|
66
66
|
- ".tool-versions"
|
67
67
|
- ".vscode/launch.json"
|
68
|
+
- Dockerfile
|
68
69
|
- Gemfile
|
69
70
|
- Gemfile.lock
|
70
71
|
- README.md
|