@webhippie/semantic-release-rubygem 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +67 -0
  3. package/index.js +36 -0
  4. package/package.json +114 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Gusto
4
+ Copyright (c) 2024 Thomas Boerger <thomas@webhippie.de>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @webhippie/semantic-release-rubygem
2
+
3
+ [**semantic-release**](https://github.com/semantic-release/semantic-release) plugin for publishing gems to [Rubygems](https://rubygems.org/).
4
+
5
+ | Step | Description | |
6
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
7
+ | `verifyConditions` | Locate and validate a `.gemspec` file, locate and validate a `lib/**/version.rb` file, verify the presence of the `GEM_HOST_API_KEY` environment variable, and create a credentials file with the API key. | |
8
+ | `prepare` | Update the version in the `lib/**/version.rb` version file and [build](https://guides.rubygems.org/command-reference/#gem-build) the gem. | |
9
+ | `publish` | [Push the gem](https://guides.rubygems.org/command-reference/#gem-push) to the gem server. | |
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ $ npm install @webhippie/semantic-release-rubygem -D
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):
20
+
21
+ ```json
22
+ {
23
+ "plugins": [
24
+ "@semantic-release/commit-analyzer",
25
+ "@semantic-release/release-notes-generator",
26
+ [
27
+ "@webhippie/semantic-release-rubygem",
28
+ {
29
+ "gemPublish": true
30
+ }
31
+ ]
32
+ ]
33
+ }
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ ### Rubygems authentication
39
+
40
+ The Rubygems authentication configuration is **required**. The API key must be set using the `GEM_HOST_API_KEY` environment variable. To retrieve the key, you can:
41
+
42
+ 1. Login to [Rubygems.org](https://rubygems.org) and click on ['Edit Profile'](https://rubygems.org/profile/edit). You'll find the key in the 'API Access' section of the page.
43
+ 2. Open a terminal on your machine and sign in using the [`gem signin`](https://guides.rubygems.org/command-reference/#gem-signin) command. After you enter your credentials, your API key will be stored as a YAML value in the `~/.gem/credentials` file under the `rubygems_api_key` key.
44
+
45
+ ### Gemspec file
46
+
47
+ This plugin requires exactly one valid `.gemspec` file to be present in the current working directory.
48
+
49
+ ### `lib/**/version.rb` file
50
+
51
+ This plugin requires the version of the published gem to be defined in a `version.rb` file somewhere in the `lib` folder (e.g. `lib/mygem/version.rb`). The version itself must be defined as a constant named `VERSION` inside the file:
52
+
53
+ ```ruby
54
+ module Mygem
55
+ VERSION = '0.0.0'.freeze
56
+ end
57
+ ```
58
+
59
+ ### Options
60
+
61
+ | Options | Description | Default |
62
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
63
+ | `gemHost` | The server to push the gem to | `'https//rubygems.org'` |
64
+ | `updateGemfileLock` | Whether to update the version of the gem to publish in the `Gemfile.lock`. This is useful if you are using the [`@semantic-release/git`](https://github.com/semantic-release/git) plugin to keep the version up to date in your git repo. When set to `true` the plugin will run `bundle install` to update the version. If another command is desired, it can be set by passing a string, e.g. `bundle appraisal install` | `false` |
65
+ | `gemPublish` | Whether to publish your gem to the server. | `true` |
66
+ | `gemFileDir` | Directory path in which to write the the built `.gem` file. If `false`, the `.gem` file will not be kept on the file system | `false` |
67
+ | `versionGlob` | The glob matching for the version file within the repository | `lib/**/version.rb` |
package/index.js ADDED
@@ -0,0 +1,36 @@
1
+ /* eslint require-atomic-updates: off */
2
+ import { temporaryFile } from "tempy";
3
+
4
+ import gemVerify from "./lib/verify.js";
5
+ import gemPrepare from "./lib/prepare.js";
6
+ import gemPublish from "./lib/publish.js";
7
+
8
+ const credentialsFile = temporaryFile({ name: "gem_credentials" });
9
+
10
+ let versionFile;
11
+
12
+ let gemName;
13
+ let gemSpec;
14
+ let gemFile;
15
+
16
+ export async function verifyConditions(pluginConfig, context) {
17
+ ({ gemName, gemSpec, versionFile } = await gemVerify(pluginConfig, context, {
18
+ credentialsFile,
19
+ }));
20
+ }
21
+
22
+ export async function prepare(pluginConfig, context) {
23
+ ({ gemFile } = await gemPrepare(pluginConfig, context, {
24
+ versionFile,
25
+ gemSpec,
26
+ gemName,
27
+ }));
28
+ }
29
+
30
+ export async function publish(pluginConfig, context) {
31
+ await gemPublish(pluginConfig, context, {
32
+ gemFile,
33
+ gemName,
34
+ credentialsFile,
35
+ });
36
+ }
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@webhippie/semantic-release-rubygem",
3
+ "description": "semantic-release plugin to publish a gem to Rubygems",
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "author": "Thomas Boerger (https://twitter.com/@tboerger)",
7
+ "ava": {
8
+ "files": [
9
+ "test/**/*.test.js",
10
+ "!test/integration.test.js"
11
+ ],
12
+ "nodeArguments": [
13
+ "--no-warnings"
14
+ ]
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/webhippie/semantic-release-rubygem/issues"
18
+ },
19
+ "contributors": [
20
+ "Rylan Collins (https://github.com/rylanc)",
21
+ "Bulat Shakirzyanov (https://github.com/avalanche123)",
22
+ "Koyanagi Satoru (https://github.com/satoruk)"
23
+ ],
24
+ "dependencies": {
25
+ "@semantic-release/error": "^4.0.0",
26
+ "execa": "^4.0.2",
27
+ "glob": "^7.1.6",
28
+ "tempy": "^0.5.0"
29
+ },
30
+ "devDependencies": {
31
+ "ava": "6.1.3",
32
+ "c8": "9.1.0",
33
+ "cpy": "11.0.1",
34
+ "cz-conventional-changelog": "3.3.0",
35
+ "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
36
+ "lockfile-lint": "4.13.2",
37
+ "ls-engines": "0.9.1",
38
+ "npm-run-all2": "6.2.0",
39
+ "prettier": "3.3.0",
40
+ "publint": "0.2.8",
41
+ "semantic-release": "24.0.0",
42
+ "sinon": "18.0.0",
43
+ "tempy": "3.1.0"
44
+ },
45
+ "engines": {
46
+ "node": ">=20.8.1"
47
+ },
48
+ "files": [
49
+ "lib",
50
+ "index.js"
51
+ ],
52
+ "homepage": "https://github.com/webhippie/semantic-release-rubygem#readme",
53
+ "keywords": [
54
+ "rubygems",
55
+ "publish",
56
+ "semantic-release",
57
+ "version"
58
+ ],
59
+ "license": "MIT",
60
+ "exports": "./index.js",
61
+ "c8": {
62
+ "include": [
63
+ "lib/**/*.js",
64
+ "index.js"
65
+ ],
66
+ "reporter": [
67
+ "json",
68
+ "text",
69
+ "html"
70
+ ],
71
+ "all": true
72
+ },
73
+ "config": {
74
+ "commitizen": {
75
+ "path": "./node_modules/cz-conventional-changelog"
76
+ }
77
+ },
78
+ "lockfile-lint": {
79
+ "path": "package-lock.json",
80
+ "type": "npm",
81
+ "validate-https": true,
82
+ "allowed-hosts": [
83
+ "npm"
84
+ ]
85
+ },
86
+ "peerDependencies": {
87
+ "semantic-release": ">=20.1.0"
88
+ },
89
+ "publishConfig": {
90
+ "access": "public",
91
+ "provenance": true
92
+ },
93
+ "repository": {
94
+ "type": "git",
95
+ "url": "https://github.com/webhippie/semantic-release-rubygem.git"
96
+ },
97
+ "scripts": {
98
+ "codecov": "codecov -f coverage/coverage-final.json",
99
+ "lint:prettier": "prettier --check \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
100
+ "lint:prettier:fix": "prettier --write \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
101
+ "lint:lockfile": "lockfile-lint",
102
+ "lint:engines": "ls-engines",
103
+ "lint:publish": "publint --strict",
104
+ "test": "npm-run-all --print-label --parallel lint:* --parallel test:*",
105
+ "test:unit": "c8 ava --verbose",
106
+ "test:integration": "ava --verbose test/integration.test.js"
107
+ },
108
+ "renovate": {
109
+ "extends": [
110
+ "github>semantic-release/.github:renovate-config"
111
+ ]
112
+ },
113
+ "packageManager": "npm@10.8.1"
114
+ }