You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-9Lines changed: 40 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# changesets-gitlab
2
2
3
-
GitLab CI cli for [changesets](https://github.com/atlassian/changesets) like its [GitHub Action](https://github.com/changesets/action), it creates a pull request with all of the package versions updated and changelogs updated and when there are new changesets on master, the PR will be updated. When you're ready, you can merge the pull request and you can either publish the packages to npm manually or setup the action to do it for you.
3
+
GitLab CI cli for [changesets](https://github.com/atlassian/changesets) like its [GitHub Action](https://github.com/changesets/action), it creates a merge request with all of the package versions updated and changelogs updated and when there are new changesets on master, the MR will be updated. When you're ready, you can merge the merge request and you can either publish the packages to npm manually or setup the action to do it for you.
4
4
5
5
## Usage
6
6
@@ -11,7 +11,7 @@ GitLab CI cli for [changesets](https://github.com/atlassian/changesets) like its
11
11
- publish - The command to use to build and publish packages
12
12
- version - The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided
13
13
- commit - The commit message to use. Default to `Version Packages`
14
-
- title - The pull request title. Default to `Version Packages`
14
+
- title - The merge request title. Default to `Version Packages`
15
15
16
16
### Outputs
17
17
@@ -29,8 +29,9 @@ GLOBAL_AGENT_NO_PROXY # Like above but for no proxied requests
29
29
30
30
GITLAB_HOST # optional, if you're using custom GitLab host
31
31
32
-
GITLAB_TOKEN # required, token with accessibility to push
33
-
GITLAB_USER_NAME # required, username with accessibility to push, used in pairs of the above token
32
+
GITLAB_TOKEN # required, token with accessibility to push
33
+
GITLAB_CI_USER_NAME # required, username with accessibility to push, used in pairs of the above token
@@ -41,10 +42,17 @@ Create a file at `.gitlab-ci.yml` with the following content.
41
42
42
43
```yml
43
44
stages:
45
+
- comment
44
46
- release
45
47
46
48
before_script: yarn --frozen-lockfile
47
49
50
+
comment:
51
+
image: node:lts-alpine
52
+
stage: comment
53
+
only: merge_requests
54
+
script: yarn changesets-gitlab -c # comment automatically like https://github.com/changesets/bot
55
+
48
56
release:
49
57
image: node:lts-alpine
50
58
only: main
@@ -53,14 +61,21 @@ release:
53
61
54
62
#### With Publishing
55
63
56
-
Before you can setup this action with publishing, you'll need to have an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) that can publish the packages in the repo you're setting up the action for and doesn't have 2FA on publish enabled ([2FA on auth can be enabled](https://docs.npmjs.com/about-two-factor-authentication)). You'll also need to [add it as a secret on your GitHub repo](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) with the name `NPM_TOKEN`. Once you've done that, you can create a file at `.github/workflows/release.yml` with the following content.
64
+
Before you can setup this action with publishing, you'll need to have an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) that can publish the packages in the repo you're setting up the action for and doesn't have 2FA on publish enabled ([2FA on auth can be enabled](https://docs.npmjs.com/about-two-factor-authentication)). You'll also need to [add it as a custom environment variable on your GitLab repo](https://docs.gitlab.com/ee/ci/variables/#custom-cicd-variables) with the name `NPM_TOKEN`. Once you've done that, you can create a file at `.gitlab-ci.yml` with the following content.
57
65
58
66
```yml
59
67
stages:
68
+
- comment
60
69
- release
61
70
62
71
before_script: yarn --frozen-lockfile
63
72
73
+
comment:
74
+
image: node:lts-alpine
75
+
stage: comment
76
+
only: merge_requests
77
+
script: yarn changesets-gitlab -c
78
+
64
79
release:
65
80
image: node:lts-alpine
66
81
only: main
@@ -69,14 +84,14 @@ release:
69
84
INPUT_PUBLISH: yarn release
70
85
```
71
86
72
-
By default the GitHub Action creates a `.npmrc` file with the following content:
87
+
By default the GitLab CI cli creates a `.npmrc` file with the following content:
However, if a `.npmrc` file is found, the GitHub Action does not recreate the file. This is useful if you need to configure the `.npmrc` file on your own.
79
-
For example, you can add a step before running the Changesets GitHub Action:
93
+
However, if a `.npmrc` file is found, the GitLab CI cli does not recreate the file. This is useful if you need to configure the `.npmrc` file on your own.
94
+
For example, you can add a step before running the Changesets GitLab CI cli:
80
95
81
96
```yml
82
97
script: |
@@ -90,14 +105,22 @@ script: |
90
105
91
106
If you need to add additional logic to the version command, you can do so by using a version script.
92
107
93
-
If the version script is present, this action will run that script instead of `changeset version`, so please make sure that your script calls `changeset version` at some point. All the changes made by the script will be included in the PR.
108
+
If the version script is present, this action will run that script instead of `changeset version`, so please make sure that your script calls `changeset version` at some point. All the changes made by the script will be included in the MR.
94
109
95
110
```yml
96
111
stages:
112
+
- comment
97
113
- release
98
114
99
115
before_script: yarn --frozen-lockfile
100
116
117
+
comment:
118
+
image: node:lts-alpine
119
+
stage: comment
120
+
only:
121
+
- merge_requests
122
+
script: yarn changesets-gitlab -c
123
+
101
124
release:
102
125
image: node:lts-alpine
103
126
only: main
@@ -112,10 +135,18 @@ If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you shoul
0 commit comments