Skip to content
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

Add docs #32

Merged
merged 9 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,37 @@

This plugin can be executed on every push to your release branch (e.g. main) and will create a new release pull-request with all of your custom adjustments like an updated changelog as preparation for the next release. After you have merged the "release"-pull-request with all your desired changes, a new release / tag will be created for you.

## Usage

### Woodpecker CI

Create a new workflow like `.woodpecker/release-helper.yml`:

```yaml
when:
event: push
branch: ${CI_REPO_DEFAULT_BRANCH}

steps:
release-helper:
image: woodpeckerci/plugin-ready-release-go:latest
settings:
git_email: my-email@example.org
github_token:
from_secret: GITHUB_TOKEN
# release_branch: 'custom-release-branch' # default: main
# pull_request_branch_prefix: 'next-release/'
# debug: true
```

## Workflow

1. Setup ready-release-go on your repository by adding a config file and a workflow file
1. On every push to your default branch a pull-request will be created and updated
1. You can review the pull-request and merge it when you are ready
1. The plugin will create a new release

## Interal workflow
## Internal workflow

- get latest release => tag
- get all commits since commit of last tag
Expand Down
75 changes: 75 additions & 0 deletions docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: Release Helper
icon: https://woodpecker-ci.org/img/logo.svg

description: Plugin for semi-automated releases.
authors: Woodpecker Authors
tags: [git, release]
containerImage: woodpeckerci/plugin-ready-release-go
containerImageUrl: https://hub.docker.com/r/woodpeckerci/plugin-ready-release-go
url: https://github.com/woodpecker-ci/plugin-ready-release-go
---

# Introduction

This plugin aims to help with git-based releases.
It should be run on every commit of the default branch to execute it's necessary actions.

A Woodpecker workflow file could look like this:

```yaml
steps:
release-helper:
image: woodpeckerci/plugin-ready-release-go
settings:
# release_branch: 'custom-release-branch' # default: CI_REPO_DEFAULT_BRANCH
git_email: <email>
github_token:
from_secret: GITHUB_TOKEN

when:
event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
```

## Features

- Create automated changelog based on PRs which updates itself after each merge to the default branch
- Auto-categorization of PRs based on labels
- Automatically determines the next semver version using the PR labels
- Supports any kind of programming language, changelog tool and commit style
- Allows to execute custom hooks like pre, post-release

## Settings

There are two parts to configure the plugin:

### 1. Most basic options can be configured via plugin settings

| Settings | Default | Description |
| ---------------------------- | ---------------------- | ------------------------------------------------- |
| `GITHUB_TOKEN` | _none_ | The GitHub token to use for the GitHub API |
| `GIT_EMAIL` | _none_ | The email to use for git commits |
| `RELEASE_BRANCH` | CI_REPO_DEFAULT_BRANCH | The branch used to merge the changelog to |
| `PULL_REQUEST_BRANCH_PREFIX` | `next-release/` | The prefix used for release pull-request branches |
| `DEBUG` | `false` | Enable debug logging |

### 2. Using a `release-config.ts` file in your repository

Add a `release-config.ts` file to the root of your repository. Have a look at the [UserConfig](https://github.com/woodpecker-ci/plugin-ready-release-go/blob/main/src/utils/types.ts) type for all available options.

```ts
export default {
commentOnReleasedPullRequests: false,
};
````

The plugin also supports executing custom hooks which can e.g. help to perform additional actions during a release (e.g. updating a helm chart's `appVersion` field):

```ts
export default {
beforePrepare: async ({ exec, nextVersion }) => {
await exec(`sed -i "s/^version:.*$/version: ${nextVersion}/g" Chart.yaml`);
},
};
```