-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying tag
parameter for setting a custom tag in BSR
#36
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,11 +46,12 @@ We recommend using [`buf-setup-action`][buf-setup] to install it (as in the exam | |
## Configuration | ||
|
||
| Parameter | Description | Required | Default | | ||
| :------------------ | :----------------------------------------------------------------------------- | :------- | :---------------------------------- | | ||
| :------------------ |:-------------------------------------------------------------------------------| :------- | :---------------------------------- | | ||
| `buf_token` | The [Buf authentication token][buf-token] used for private [Buf inputs][input] | ✅ | [`${{github.token}}`][github-token] | | ||
| `input` | The path of the [input] you want to push to BSR as a module | | `.` | | ||
| `draft` | Indicates if the workflows should push to the BSR as a [draft][buf-draft] | | | | ||
| `create_visibility` | The visibility to create the BSR repository with, if it does not already exist | | | | ||
| `tag` | The custom tag to push to the BSR | | | | ||
|
||
> These parameters are derived from [`action.yml`](./action.yml). | ||
|
||
|
@@ -129,6 +130,26 @@ is not supported by `buf-push-action` on its own - you'll need to stitch this fu | |
your workflow on your own. For more details, see [this](https://github.com/bufbuild/buf/issues/838) | ||
discussion. | ||
|
||
### Push with a custom tag | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, you cannot Suggestion: at the end of this section, I would add the following warning:
|
||
|
||
If you want to push a module with a tag other than the Git commit SHA (e.g. for using semantic | ||
versioning), you can set the `tag` property to the desired tag: | ||
|
||
```yaml | ||
steps: | ||
# Run `git checkout` | ||
- uses: actions/checkout@v2 | ||
# Install the `buf` CLI | ||
- uses: bufbuild/buf-setup-action@v1 | ||
# Push only the Input in `proto` to the BSR | ||
- uses: bufbuild/buf-push-action@v1 | ||
with: | ||
input: proto | ||
buf_token: ${{ secrets.BUF_TOKEN }} | ||
# if triggered by a release tag, push with the tag | ||
tag: ${{ github.ref_name }} | ||
``` | ||
|
||
### Validate before push | ||
|
||
`buf-push-action` is typically used alongside other `buf` Actions, such as | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,12 @@ if [ -z "$BUF_COMMAND" ]; then | |
fail "$NOT_INSTALLED_MESSAGE" | ||
fi | ||
|
||
BUF_ARGS=("--tag" "${GITHUB_SHA}") | ||
VERSION=${GITHUB_SHA} | ||
if [ -n "${TAG}" ]; then | ||
VERSION="${TAG}" | ||
fi | ||
Comment on lines
+40
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should have a default behaviour if no tag is set. It should either be "no tag" or "tag with configured value". |
||
|
||
BUF_ARGS=("--tag" "$VERSION") | ||
if [ "${DRAFT}" == "true" ]; then | ||
Comment on lines
+45
to
46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have a check that does not set both |
||
# Check that --draft is supported by running "buf push --draft example --help" | ||
# and checking for "unknown flag: --draft" in the output. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we don't support "moving"/"re-writing" the same tag to a different commit. So if a user tries to set a single, static tag, their subsequent pushes will fail. This should be called out here.
Suggestion on this documentation:
" A custom tag to push with each commit. The BSR does not currently support moving or duplicated tags, so use this with care."