mirror of
https://github.com/thegeeklab/wp-gitea-release.git
synced 2024-11-24 13:00:40 +00:00
docs: cleanup docs and parameters
This commit is contained in:
parent
95511ca41e
commit
9980b6624d
2
.github/settings.yml
vendored
2
.github/settings.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
repository:
|
repository:
|
||||||
name: wp-gitea-release
|
name: wp-gitea-release
|
||||||
description: Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests
|
description: Woodpecker CI plugin to publish files and artifacts to Gitea releases
|
||||||
homepage: https://woodpecker-plugins.geekdocs.de/plugins/wp-gitea-release
|
homepage: https://woodpecker-plugins.geekdocs.de/plugins/wp-gitea-release
|
||||||
topics: woodpecker-ci, woodpecker, woodpecker-plugin
|
topics: woodpecker-ci, woodpecker, woodpecker-plugin
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ steps:
|
|||||||
target: DOCKER_USER
|
target: DOCKER_USER
|
||||||
environment:
|
environment:
|
||||||
PUSHRM_FILE: README.md
|
PUSHRM_FILE: README.md
|
||||||
PUSHRM_SHORT: Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests
|
PUSHRM_SHORT: Woodpecker CI plugin to publish files and artifacts to Gitea releases
|
||||||
PUSHRM_TARGET: ${CI_REPO}
|
PUSHRM_TARGET: ${CI_REPO}
|
||||||
when:
|
when:
|
||||||
- event: [push, manual]
|
- event: [push, manual]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# wp-gitea-release
|
# wp-gitea-release
|
||||||
|
|
||||||
Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests
|
Woodpecker CI plugin to publish files and artifacts to Gitea releases
|
||||||
|
|
||||||
[![Build Status](https://ci.thegeeklab.de/api/badges/thegeeklab/wp-gitea-release/status.svg)](https://ci.thegeeklab.de/repos/thegeeklab/wp-gitea-release)
|
[![Build Status](https://ci.thegeeklab.de/api/badges/thegeeklab/wp-gitea-release/status.svg)](https://ci.thegeeklab.de/repos/thegeeklab/wp-gitea-release)
|
||||||
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wp-gitea-release)
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wp-gitea-release)
|
||||||
@ -10,7 +10,7 @@ Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests
|
|||||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-gitea-release)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-gitea-release)
|
||||||
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-gitea-release)](https://github.com/thegeeklab/wp-gitea-release/blob/main/LICENSE)
|
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-gitea-release)](https://github.com/thegeeklab/wp-gitea-release/blob/main/LICENSE)
|
||||||
|
|
||||||
Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests. You can find the full documentation at [https://woodpecker-plugins.geekdocs.de](https://woodpecker-plugins.geekdocs.de/plugins/wp-gitea-release).
|
Woodpecker CI plugin to publish files and artifacts to Gitea releases. You can find the full documentation at [https://woodpecker-plugins.geekdocs.de](https://woodpecker-plugins.geekdocs.de/plugins/wp-gitea-release).
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "api-key",
|
Name: "api-key",
|
||||||
Usage: "api key to access gitea api",
|
Usage: "api key to access Gitea API",
|
||||||
EnvVars: []string{"PLUGIN_API_KEY", "GITEA_RELEASE_API_KEY", "GITEA_TOKEN"},
|
EnvVars: []string{"PLUGIN_API_KEY", "GITEA_RELEASE_API_KEY", "GITEA_TOKEN"},
|
||||||
Destination: &settings.APIKey,
|
Destination: &settings.APIKey,
|
||||||
Category: category,
|
Category: category,
|
||||||
@ -55,37 +55,24 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "base-url",
|
Name: "base-url",
|
||||||
Usage: "url of the gitea instance",
|
Usage: "URL of the Gitea instance",
|
||||||
EnvVars: []string{"PLUGIN_BASE_URL", "GITEA_RELEASE_BASE_URL"},
|
EnvVars: []string{"PLUGIN_BASE_URL", "GITEA_RELEASE_BASE_URL"},
|
||||||
Category: category,
|
Category: category,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "note",
|
Name: "note",
|
||||||
Usage: "file or string with notes for the release (example: changelog)",
|
Usage: "file or string with notes for the release",
|
||||||
EnvVars: []string{"PLUGIN_NOTE", "GITEA_RELEASE_NOTE"},
|
EnvVars: []string{"PLUGIN_NOTE", "GITEA_RELEASE_NOTE"},
|
||||||
Destination: &settings.Note,
|
Destination: &settings.Note,
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "title",
|
Name: "title",
|
||||||
Usage: "file or string for the title shown in the gitea release",
|
Usage: "file or string for the title shown in the Gitea release",
|
||||||
EnvVars: []string{"PLUGIN_TITLE", "GITEA_RELEASE_TITLE"},
|
EnvVars: []string{"PLUGIN_TITLE", "GITEA_RELEASE_TITLE", "CI_COMMIT_TAG"},
|
||||||
Destination: &settings.Title,
|
Destination: &settings.Title,
|
||||||
Category: category,
|
DefaultText: "$CI_COMMIT_TAG",
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "repo.owner",
|
|
||||||
Usage: "repository owner",
|
|
||||||
EnvVars: []string{"CI_REPO_OWNER"},
|
|
||||||
Destination: &settings.Repo.Owner,
|
|
||||||
Category: category,
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "repo.name",
|
|
||||||
Usage: "repository name",
|
|
||||||
EnvVars: []string{"CI_REPO_NAME"},
|
|
||||||
Destination: &settings.Repo.Name,
|
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
@ -94,6 +81,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
Usage: "build event",
|
Usage: "build event",
|
||||||
EnvVars: []string{"CI_PIPELINE_EVENT"},
|
EnvVars: []string{"CI_PIPELINE_EVENT"},
|
||||||
Destination: &settings.Event,
|
Destination: &settings.Event,
|
||||||
|
DefaultText: "$CI_PIPELINE_EVENT",
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
|
@ -18,7 +18,7 @@ func main() {
|
|||||||
settings := &plugin.Settings{}
|
settings := &plugin.Settings{}
|
||||||
options := wp.Options{
|
options := wp.Options{
|
||||||
Name: "wp-gitea-release",
|
Name: "wp-gitea-release",
|
||||||
Description: "Add comments to GitHub Issues and Pull Requests",
|
Description: "Publish files and artifacts to Gitea releases",
|
||||||
Version: BuildVersion,
|
Version: BuildVersion,
|
||||||
VersionMetadata: fmt.Sprintf("date=%s", BuildDate),
|
VersionMetadata: fmt.Sprintf("date=%s", BuildDate),
|
||||||
Flags: settingsFlags(settings, wp.FlagsPluginCategory),
|
Flags: settingsFlags(settings, wp.FlagsPluginCategory),
|
||||||
|
@ -10,7 +10,7 @@ title: wp-gitea-release
|
|||||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-gitea-release)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-gitea-release)
|
||||||
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-gitea-release)](https://github.com/thegeeklab/wp-gitea-release/blob/main/LICENSE)
|
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-gitea-release)](https://github.com/thegeeklab/wp-gitea-release/blob/main/LICENSE)
|
||||||
|
|
||||||
Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests.
|
Woodpecker CI plugin to publish files and artifacts to Gitea releases.
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
@ -20,12 +20,8 @@ Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
{{< hint type=important >}}
|
|
||||||
Due to the nature of this plugin, a secret for the GitHub token may need to be exposed for pull request events in Woodpecker. Please be careful with this option, as a malicious actor may submit a pull request that exposes your secrets. Do not disclose secrets to pull requests in public environments without further protection.
|
|
||||||
{{< /hint >}}
|
|
||||||
|
|
||||||
{{< hint type=note >}}
|
{{< hint type=note >}}
|
||||||
Only pull request events are supported by this plugin. Running the plugin on other events will result in an error.
|
Only tag events are supported by this plugin. Running the plugin on other events will result in an error.
|
||||||
{{< /hint >}}
|
{{< /hint >}}
|
||||||
|
|
||||||
```YAML
|
```YAML
|
||||||
@ -33,12 +29,12 @@ kind: pipeline
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: pr-comment
|
- name: publish
|
||||||
image: quay.io/thegeeklab/wp-gitea-release
|
image: quay.io/thegeeklab/wp-gitea-release
|
||||||
settings:
|
settings:
|
||||||
api_key: ghp_3LbMg9Kncpdkhjp3bh3dMnKNXLjVMTsXk4sM
|
api_key: 3LbMg9Kncpdkhjp3bh3dMnKNXLjVMTsXk4sM
|
||||||
message: "CI run completed successfully"
|
base_url: https://gitea.rknet.org
|
||||||
update: true
|
files: build/*
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
@ -67,12 +63,12 @@ docker build --file Containerfile.multiarch --tag thegeeklab/wp-gitea-release .
|
|||||||
|
|
||||||
```Shell
|
```Shell
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e CI_PIPELINE_EVENT=pull_request \
|
-e PLUGIN_BASE_URL=https://try.gitea.io \
|
||||||
-e CI_REPO_OWNER=octocat \
|
-e PLUGIN_API_KEY=your-api-key \
|
||||||
-e CI_REPO_NAME=foo \
|
-e PLUGIN_FILES=build/* \
|
||||||
-e CI_COMMIT_PULL_REQUEST=1
|
-e CI_REPO_OWNER=gitea \
|
||||||
-e PLUGIN_API_KEY=abc123 \
|
-e CI_REPO_NAME=test \
|
||||||
-e PLUGIN_MESSAGE="Demo comment" \
|
-e CI_PIPELINE_EVENT=tag \
|
||||||
-v $(pwd):/build:z \
|
-v $(pwd):/build:z \
|
||||||
-w /build \
|
-w /build \
|
||||||
thegeeklab/wp-gitea-release
|
thegeeklab/wp-gitea-release
|
||||||
|
@ -2,43 +2,58 @@
|
|||||||
properties:
|
properties:
|
||||||
- name: api_key
|
- name: api_key
|
||||||
description: |
|
description: |
|
||||||
Personal access token to access the GitHub API.
|
Api key to access Gitea API.
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- name: base_url
|
- name: base_url
|
||||||
description: |
|
description: |
|
||||||
Api url.
|
URL of the Gitea instance.
|
||||||
|
|
||||||
Only need to be changed for GitHub enterprise in most cases.
|
|
||||||
type: string
|
|
||||||
defaultValue: "https://api.github.com/"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- name: key
|
|
||||||
description: |
|
|
||||||
Unique identifier to assign to a comment.
|
|
||||||
|
|
||||||
The identifier is used to update an existing comment.
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- name: message
|
|
||||||
description: |
|
|
||||||
Path to file or string that contains the comment text.
|
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- name: skip_missing
|
- name: checksum
|
||||||
description: |
|
description: |
|
||||||
Skip comment creation if the given message file does not exist.
|
Generate specific checksums.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: draft
|
||||||
|
description: |
|
||||||
|
Create a draft release.
|
||||||
type: bool
|
type: bool
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- name: update
|
- name: file_exist
|
||||||
description: |
|
description: |
|
||||||
Enable update of an existing comment that matches the key.
|
What to do if file already exist.
|
||||||
|
type: string
|
||||||
|
defaultValue: "overwrite"
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: files
|
||||||
|
description: |
|
||||||
|
List of files to upload.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: note
|
||||||
|
description: |
|
||||||
|
File or string with notes for the release.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: prerelease
|
||||||
|
description: |
|
||||||
|
Set the release as prerelease.
|
||||||
type: bool
|
type: bool
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
- name: title
|
||||||
|
description: |
|
||||||
|
File or string for the title shown in the Gitea release.
|
||||||
|
type: string
|
||||||
|
defaultValue: $CI_COMMIT_TAG
|
||||||
|
required: false
|
||||||
|
@ -82,8 +82,8 @@ func (p *Plugin) Execute() error {
|
|||||||
|
|
||||||
rc := releaseClient{
|
rc := releaseClient{
|
||||||
Client: client,
|
Client: client,
|
||||||
Owner: p.Settings.Repo.Owner,
|
Owner: p.Metadata.Repository.Owner,
|
||||||
Repo: p.Settings.Repo.Name,
|
Repo: p.Metadata.Repository.Name,
|
||||||
Tag: strings.TrimPrefix(p.Settings.CommitRef, "refs/tags/"),
|
Tag: strings.TrimPrefix(p.Settings.CommitRef, "refs/tags/"),
|
||||||
Draft: p.Settings.Draft,
|
Draft: p.Settings.Draft,
|
||||||
Prerelease: p.Settings.PreRelease,
|
Prerelease: p.Settings.PreRelease,
|
||||||
@ -92,12 +92,6 @@ func (p *Plugin) Execute() error {
|
|||||||
Note: p.Settings.Note,
|
Note: p.Settings.Note,
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the title was not provided via .drone.yml we use the tag instead
|
|
||||||
// fixes https://github.com/drone-plugins/drone-gitea-release/issues/26
|
|
||||||
if rc.Title == "" {
|
|
||||||
rc.Title = rc.Tag
|
|
||||||
}
|
|
||||||
|
|
||||||
release, err := rc.buildRelease()
|
release, err := rc.buildRelease()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create the release: %w", err)
|
return fmt.Errorf("failed to create the release: %w", err)
|
||||||
|
@ -27,13 +27,6 @@ type Settings struct {
|
|||||||
|
|
||||||
baseURL *url.URL
|
baseURL *url.URL
|
||||||
files []string
|
files []string
|
||||||
|
|
||||||
Repo Repo
|
|
||||||
}
|
|
||||||
|
|
||||||
type Repo struct {
|
|
||||||
Owner string
|
|
||||||
Name string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(options wp.Options, settings *Settings) *Plugin {
|
func New(options wp.Options, settings *Settings) *Plugin {
|
||||||
|
@ -15,7 +15,7 @@ var (
|
|||||||
ErrFileExists = errors.New("asset file already exist")
|
ErrFileExists = errors.New("asset file already exist")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Release holds ties the drone env data and gitea client together.
|
// Release holds ties the Woodpecker env data and gitea client together.
|
||||||
type releaseClient struct {
|
type releaseClient struct {
|
||||||
*gitea.Client
|
*gitea.Client
|
||||||
Owner string
|
Owner string
|
||||||
|
Loading…
Reference in New Issue
Block a user