mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-02-10 03:37:03 +00:00
Compare commits
3 commits
8ce5b765e2
...
b2e2dd9a17
| Author | SHA1 | Date | |
|---|---|---|---|
| b2e2dd9a17 | |||
| a7811991ee | |||
| c1db1b20e0 |
18 changed files with 83 additions and 221 deletions
16
.github/actions/setup-mdbook/action.yaml
vendored
16
.github/actions/setup-mdbook/action.yaml
vendored
|
|
@ -1,16 +0,0 @@
|
||||||
name: "Setup mdbook"
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: "mdbook version"
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Setup mdbook
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
url: https://github.com/rust-lang/mdbook/releases/download/${{ inputs.version }}/mdbook-${{ inputs.version }}-x86_64-unknown-linux-gnu.tar.gz
|
|
||||||
run: |
|
|
||||||
mkdir mdbook
|
|
||||||
curl -sSL "$url" | tar -xz --directory=./mdbook
|
|
||||||
echo `pwd`/mdbook >> $GITHUB_PATH
|
|
||||||
80
.github/renovate.json5
vendored
80
.github/renovate.json5
vendored
|
|
@ -1,80 +0,0 @@
|
||||||
{
|
|
||||||
"extends": [
|
|
||||||
":semanticCommits",
|
|
||||||
":semanticCommitTypeAll(deps)",
|
|
||||||
":semanticCommitScopeDisabled",
|
|
||||||
|
|
||||||
":dependencyDashboard",
|
|
||||||
":approveMajorUpdates",
|
|
||||||
|
|
||||||
":automergeMinor",
|
|
||||||
":automergeLinters",
|
|
||||||
":automergeTesters",
|
|
||||||
":automergeTypes",
|
|
||||||
|
|
||||||
":maintainLockFilesWeekly",
|
|
||||||
":enableVulnerabilityAlerts",
|
|
||||||
"helpers:pinGitHubActionDigests"
|
|
||||||
],
|
|
||||||
"packageRules": [
|
|
||||||
{
|
|
||||||
"groupName": "linters",
|
|
||||||
"matchUpdateTypes": [
|
|
||||||
"minor",
|
|
||||||
"patch"
|
|
||||||
],
|
|
||||||
"matchDepNames": [
|
|
||||||
"golangci/golangci-lint"
|
|
||||||
],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"groupName": "testing",
|
|
||||||
"matchUpdateTypes": [
|
|
||||||
"minor",
|
|
||||||
"patch"
|
|
||||||
],
|
|
||||||
"matchDepNames": [
|
|
||||||
"github.com/stretchr/testify"
|
|
||||||
],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"groupName": "github-actions",
|
|
||||||
"matchUpdateTypes": [
|
|
||||||
"minor",
|
|
||||||
"patch"
|
|
||||||
],
|
|
||||||
"matchDepTypes": [
|
|
||||||
"action"
|
|
||||||
],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"groupName": "gitlab-ci",
|
|
||||||
"matchUpdateTypes": [
|
|
||||||
"minor",
|
|
||||||
"patch"
|
|
||||||
],
|
|
||||||
"matchPackageNames": [
|
|
||||||
"registry.gitlab.com/gitlab-org/release-cli"
|
|
||||||
],
|
|
||||||
"automerge": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"customManagers": [
|
|
||||||
{
|
|
||||||
"customType": "regex",
|
|
||||||
"fileMatch": [
|
|
||||||
".+\\.ya?ml$"
|
|
||||||
],
|
|
||||||
"matchStrings": [
|
|
||||||
": (?<currentValue>.+) # renovate: datasource=(?<datasource>[a-z-]+) depName=(?<depName>[^\\s]+)(?: lookupName=(?<lookupName>[^\\s]+))?(?: versioning=(?<versioning>[a-z-]+))?(?: extractVersion=(?<extractVersion>[^\\s]+))?"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"postUpdateOptions": [
|
|
||||||
"gomodUpdateImportPaths",
|
|
||||||
"gomodTidy"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
20
.github/workflows/ci.yaml
vendored
20
.github/workflows/ci.yaml
vendored
|
|
@ -5,32 +5,34 @@ on:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Run golangci-lint
|
- name: Run golangci-lint
|
||||||
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6
|
uses: golangci/golangci-lint-action@v6
|
||||||
with:
|
with:
|
||||||
version: v1.61.0 # renovate: datasource=github-releases depName=golangci/golangci-lint
|
version: v1.60.1 # renovate: datasource=github-releases depName=golangci/golangci-lint
|
||||||
args: --timeout 5m
|
args: --timeout 5m
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
|
@ -38,7 +40,7 @@ jobs:
|
||||||
run: go test -v -race -coverpkg=./... -coverprofile=coverage.txt ./...
|
run: go test -v -race -coverpkg=./... -coverprofile=coverage.txt ./...
|
||||||
|
|
||||||
- name: Upload results to Codecov
|
- name: Upload results to Codecov
|
||||||
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
|
@ -46,10 +48,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
|
|
||||||
33
.github/workflows/docs.yaml
vendored
33
.github/workflows/docs.yaml
vendored
|
|
@ -11,29 +11,30 @@ jobs:
|
||||||
contents: write # To push a branch
|
contents: write # To push a branch
|
||||||
pages: write # To push to a GitHub Pages site
|
pages: write # To push to a GitHub Pages site
|
||||||
id-token: write # To update the deployment status
|
id-token: write # To update the deployment status
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
lfs: "true"
|
lfs: "true"
|
||||||
|
- name: Install latest mdbook
|
||||||
- uses: ./.github/actions/setup-mdbook
|
run: |
|
||||||
with:
|
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
|
||||||
version: v0.4.40 # renovate: datasource=github-releases depName=rust-lang/mdbook
|
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
|
||||||
|
mkdir mdbook
|
||||||
|
curl -sSL $url | tar -xz --directory=./mdbook
|
||||||
|
echo `pwd`/mdbook >> $GITHUB_PATH
|
||||||
- name: Build Book
|
- name: Build Book
|
||||||
working-directory: docs
|
run: |
|
||||||
run: mdbook build
|
# This assumes your book is in the root of your repository.
|
||||||
|
# Just add a `cd` here if you need to change to another directory.
|
||||||
|
cd docs
|
||||||
|
mdbook build
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
# Upload entire repository
|
# Upload entire repository
|
||||||
path: "docs/book"
|
path: 'docs/book'
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
|
uses: actions/deploy-pages@v4
|
||||||
|
|
|
||||||
2
.github/workflows/mirror.yaml
vendored
2
.github/workflows/mirror.yaml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
||||||
REMOTE: mirror
|
REMOTE: mirror
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# Need all to fetch all tags so we can push them
|
# Need all to fetch all tags so we can push them
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
|
||||||
6
.github/workflows/release.yaml
vendored
6
.github/workflows/release.yaml
vendored
|
|
@ -14,12 +14,12 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- uses: ko-build/setup-ko@3aebd0597dc1e9d1a26bcfdb7cbeb19c131d3037 # v0.7
|
- uses: ko-build/setup-ko@v0.7
|
||||||
- run: ko build --bare --tags ${{ github.ref_name }} github.com/apricote/releaser-pleaser/cmd/rp
|
- run: ko build --bare --tags ${{ github.ref_name }} github.com/apricote/releaser-pleaser/cmd/rp
|
||||||
|
|
|
||||||
6
.github/workflows/releaser-pleaser.yaml
vendored
6
.github/workflows/releaser-pleaser.yaml
vendored
|
|
@ -18,19 +18,19 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
# Build container image from current commit and replace image ref in `action.yml`
|
# Build container image from current commit and replace image ref in `action.yml`
|
||||||
# Without this, any new flags in `action.yml` would break the job in this repository until the new
|
# Without this, any new flags in `action.yml` would break the job in this repository until the new
|
||||||
# version is released. But a new version can only be released if this job works.
|
# version is released. But a new version can only be released if this job works.
|
||||||
- uses: ko-build/setup-ko@3aebd0597dc1e9d1a26bcfdb7cbeb19c131d3037 # v0.7
|
- uses: ko-build/setup-ko@v0.7
|
||||||
- run: ko build --bare --local --tags ci github.com/apricote/releaser-pleaser/cmd/rp
|
- run: ko build --bare --local --tags ci github.com/apricote/releaser-pleaser/cmd/rp
|
||||||
|
|
||||||
- run: mkdir -p .github/actions/releaser-pleaser
|
- run: mkdir -p .github/actions/releaser-pleaser
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ stages: [ release ]
|
||||||
# and create a corresponding GitLab Release.
|
# and create a corresponding GitLab Release.
|
||||||
create-release:
|
create-release:
|
||||||
stage: release
|
stage: release
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:v0.18.0
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
script: echo "Creating release $CI_COMMIT_TAG"
|
script: echo "Creating release $CI_COMMIT_TAG"
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ You can now edit the message for a pull request after merging by adding a \```rp
|
||||||
- **cli**: show release PR url in log messages (#44)
|
- **cli**: show release PR url in log messages (#44)
|
||||||
|
|
||||||
## [v0.2.0](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0)
|
## [v0.2.0](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- update version references in any files (#14)
|
- update version references in any files (#14)
|
||||||
|
|
@ -56,7 +55,6 @@ You can now edit the message for a pull request after merging by adding a \```rp
|
||||||
- **action**: invalid quoting for extra-files arg (#25)
|
- **action**: invalid quoting for extra-files arg (#25)
|
||||||
|
|
||||||
## [v0.2.0-beta.2](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0-beta.2)
|
## [v0.2.0-beta.2](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0-beta.2)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- update version references in any files (#14)
|
- update version references in any files (#14)
|
||||||
|
|
@ -67,7 +65,6 @@ You can now edit the message for a pull request after merging by adding a \```rp
|
||||||
- **ci**: ko pipeline permissions (#23)
|
- **ci**: ko pipeline permissions (#23)
|
||||||
|
|
||||||
## [v0.2.0-beta.1](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0-beta.1)
|
## [v0.2.0-beta.1](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0-beta.1)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- update version references in any files (#14)
|
- update version references in any files (#14)
|
||||||
|
|
@ -77,15 +74,14 @@ You can now edit the message for a pull request after merging by adding a \```rp
|
||||||
- **ci**: building release image fails (#21)
|
- **ci**: building release image fails (#21)
|
||||||
|
|
||||||
## [v0.2.0-beta.0](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0-beta.0)
|
## [v0.2.0-beta.0](https://github.com/apricote/releaser-pleaser/releases/tag/v0.2.0-beta.0)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- update version references in any files (#14)
|
- update version references in any files (#14)
|
||||||
|
|
||||||
## [v0.1.0](https://github.com/apricote/releaser-pleaser/releases/tag/v0.1.0)
|
## [v0.1.0](https://github.com/apricote/releaser-pleaser/releases/tag/v0.1.0)
|
||||||
|
|
||||||
### This is the first release ever, so it also includes a lot of other functionality.
|
### This is the first release ever, so it also includes a lot of other functionality.
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- add github action (#1)
|
- add github action (#1)
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,14 @@
|
||||||
|
|
||||||
## Relation to `release-please`
|
## Relation to `release-please`
|
||||||
|
|
||||||
After using
|
After using `release-please` for 1.5 years, I've found it to be the best tool for low-effort releases currently available. While I appreciate many of its features, I identified several additional capabilities that would significantly enhance my workflow. Although it might be possible to incorporate these features into `release-please`, I decided to channel my efforts into creating a new tool that specifically addresses my needs.
|
||||||
`release-please` for 1.5 years, I've found it to be the best tool for low-effort releases currently available. While I appreciate many of its features, I identified several additional capabilities that would significantly enhance my workflow. Although it might be possible to incorporate these features into
|
|
||||||
`release-please`, I decided to channel my efforts into creating a new tool that specifically addresses my needs.
|
|
||||||
|
|
||||||
Key differences in `releaser-pleaser` include:
|
Key differences in `releaser-pleaser` include:
|
||||||
|
|
||||||
- Support for multiple forges (both GitHub and GitLab)
|
- Support for multiple forges (both GitHub and GitLab)
|
||||||
- Better support for pre-releases
|
- Better support for pre-releases
|
||||||
|
|
||||||
One notable limitation of
|
One notable limitation of `release-please` is its deep integration with the GitHub API, making the addition of support for other platforms (like GitLab) a substantial undertaking. `releaser-pleaser` aims to overcome this limitation by design, offering a more versatile solution for automated release management across different platforms and project requirements.
|
||||||
`release-please` is its deep integration with the GitHub API, making the addition of support for other platforms (like GitLab) a substantial undertaking.
|
|
||||||
`releaser-pleaser` aims to overcome this limitation by design, offering a more versatile solution for automated release management across different platforms and project requirements.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
||||||
4
go.mod
4
go.mod
|
|
@ -5,7 +5,7 @@ go 1.23.0
|
||||||
require (
|
require (
|
||||||
github.com/blang/semver/v4 v4.0.0
|
github.com/blang/semver/v4 v4.0.0
|
||||||
github.com/go-git/go-git/v5 v5.12.0
|
github.com/go-git/go-git/v5 v5.12.0
|
||||||
github.com/google/go-github/v65 v65.0.0
|
github.com/google/go-github/v63 v63.0.0
|
||||||
github.com/leodido/go-conventionalcommits v0.12.0
|
github.com/leodido/go-conventionalcommits v0.12.0
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.8.1
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
|
|
@ -45,7 +45,7 @@ require (
|
||||||
golang.org/x/sys v0.24.0 // indirect
|
golang.org/x/sys v0.24.0 // indirect
|
||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/protobuf v1.33.0 // indirect
|
google.golang.org/protobuf v1.29.1 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
8
go.sum
8
go.sum
|
|
@ -47,8 +47,8 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-github/v65 v65.0.0 h1:pQ7BmO3DZivvFk92geC0jB0q2m3gyn8vnYPgV7GSLhQ=
|
github.com/google/go-github/v63 v63.0.0 h1:13xwK/wk9alSokujB9lJkuzdmQuVn2QCPeck76wR3nE=
|
||||||
github.com/google/go-github/v65 v65.0.0/go.mod h1:DvrqWo5hvsdhJvHd4WyVF9ttANN3BniqjP8uTFMNb60=
|
github.com/google/go-github/v63 v63.0.0/go.mod h1:IqbcrgUmIcEaioWrGYei/09o+ge5vhffGOcxrO0AfmA=
|
||||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||||
|
|
@ -183,8 +183,8 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
|
||||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
|
|
||||||
|
|
@ -26,37 +26,27 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultTemplate() *template.Template {
|
func NewChangelogEntry(logger *slog.Logger, commits []commitparser.AnalyzedCommit, version, link, prefix, suffix string) (string, error) {
|
||||||
return changelogTemplate
|
features := make([]commitparser.AnalyzedCommit, 0)
|
||||||
}
|
fixes := make([]commitparser.AnalyzedCommit, 0)
|
||||||
|
|
||||||
type Data struct {
|
for _, commit := range commits {
|
||||||
Commits map[string][]commitparser.AnalyzedCommit
|
switch commit.Type {
|
||||||
Version string
|
case "feat":
|
||||||
VersionLink string
|
features = append(features, commit)
|
||||||
Prefix string
|
case "fix":
|
||||||
Suffix string
|
fixes = append(fixes, commit)
|
||||||
}
|
|
||||||
|
|
||||||
func New(commits map[string][]commitparser.AnalyzedCommit, version, versionLink, prefix, suffix string) Data {
|
|
||||||
return Data{
|
|
||||||
Commits: commits,
|
|
||||||
Version: version,
|
|
||||||
VersionLink: versionLink,
|
|
||||||
Prefix: prefix,
|
|
||||||
Suffix: suffix,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Formatting struct {
|
|
||||||
HideVersionTitle bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func Entry(logger *slog.Logger, tpl *template.Template, data Data, formatting Formatting) (string, error) {
|
|
||||||
var changelog bytes.Buffer
|
var changelog bytes.Buffer
|
||||||
err := tpl.Execute(&changelog, map[string]any{
|
err := changelogTemplate.Execute(&changelog, map[string]any{
|
||||||
"Data": data,
|
"Features": features,
|
||||||
"Formatting": formatting,
|
"Fixes": fixes,
|
||||||
|
"Version": version,
|
||||||
|
"VersionLink": link,
|
||||||
|
"Prefix": prefix,
|
||||||
|
"Suffix": suffix,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,22 @@
|
||||||
{{define "entry" -}}
|
## [{{.Version}}]({{.VersionLink}})
|
||||||
- {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}}
|
{{- if .Prefix }}
|
||||||
{{ end }}
|
{{ .Prefix }}
|
||||||
|
|
||||||
{{- if not .Formatting.HideVersionTitle }}
|
|
||||||
## [{{.Data.Version}}]({{.Data.VersionLink}})
|
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{- if .Data.Prefix }}
|
{{- if (gt (len .Features) 0) }}
|
||||||
{{ .Data.Prefix }}
|
|
||||||
{{ end -}}
|
|
||||||
{{- with .Data.Commits.feat }}
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
{{ range . -}}{{template "entry" .}}{{end}}
|
{{ range .Features -}}
|
||||||
|
- {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}}
|
||||||
|
{{ end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Data.Commits.fix }}
|
{{- if (gt (len .Fixes) 0) }}
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
{{ range . -}}{{template "entry" .}}{{end}}
|
{{ range .Fixes -}}
|
||||||
|
- {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}}
|
||||||
|
{{ end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if .Data.Suffix }}
|
{{- if .Suffix }}
|
||||||
{{ .Data.Suffix }}
|
{{ .Suffix }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,7 @@ This version is compatible with flux-compensator v2.2 - v2.9.
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
data := New(commitparser.ByType(tt.args.analyzedCommits), tt.args.version, tt.args.link, tt.args.prefix, tt.args.suffix)
|
got, err := NewChangelogEntry(slog.Default(), tt.args.analyzedCommits, tt.args.version, tt.args.link, tt.args.prefix, tt.args.suffix)
|
||||||
got, err := Entry(slog.Default(), DefaultTemplate(), data, Formatting{})
|
|
||||||
if !tt.wantErr(t, err) {
|
if !tt.wantErr(t, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,3 @@ type AnalyzedCommit struct {
|
||||||
Scope *string
|
Scope *string
|
||||||
BreakingChange bool
|
BreakingChange bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ByType groups the Commits by the type field. Used by the Changelog.
|
|
||||||
func ByType(in []AnalyzedCommit) map[string][]AnalyzedCommit {
|
|
||||||
out := map[string][]AnalyzedCommit{}
|
|
||||||
|
|
||||||
for _, commit := range in {
|
|
||||||
if out[commit.Type] == nil {
|
|
||||||
out[commit.Type] = make([]AnalyzedCommit, 0, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
out[commit.Type] = append(out[commit.Type], commit)
|
|
||||||
}
|
|
||||||
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/blang/semver/v4"
|
"github.com/blang/semver/v4"
|
||||||
"github.com/go-git/go-git/v5/plumbing/transport"
|
"github.com/go-git/go-git/v5/plumbing/transport"
|
||||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||||
"github.com/google/go-github/v65/github"
|
"github.com/google/go-github/v63/github"
|
||||||
|
|
||||||
"github.com/apricote/releaser-pleaser/internal/forge"
|
"github.com/apricote/releaser-pleaser/internal/forge"
|
||||||
"github.com/apricote/releaser-pleaser/internal/git"
|
"github.com/apricote/releaser-pleaser/internal/git"
|
||||||
|
|
|
||||||
|
|
@ -243,9 +243,7 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
changelogData := changelog.New(commitparser.ByType(analyzedCommits), nextVersion, rp.forge.ReleaseURL(nextVersion), releaseOverrides.Prefix, releaseOverrides.Suffix)
|
changelogEntry, err := changelog.NewChangelogEntry(logger, analyzedCommits, nextVersion, rp.forge.ReleaseURL(nextVersion), releaseOverrides.Prefix, releaseOverrides.Suffix)
|
||||||
|
|
||||||
changelogEntry, err := changelog.Entry(logger, changelog.DefaultTemplate(), changelogData, changelog.Formatting{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to build changelog entry: %w", err)
|
return fmt.Errorf("failed to build changelog entry: %w", err)
|
||||||
}
|
}
|
||||||
|
|
@ -291,16 +289,9 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
|
||||||
logger.InfoContext(ctx, "file content is already up-to-date in remote branch, skipping push")
|
logger.InfoContext(ctx, "file content is already up-to-date in remote branch, skipping push")
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not need the version title here. In the pull request the version is available from the title, and in the
|
|
||||||
// release on the Forge its usually in a heading somewhere above the text.
|
|
||||||
changelogEntryPullRequest, err := changelog.Entry(logger, changelog.DefaultTemplate(), changelogData, changelog.Formatting{HideVersionTitle: true})
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to build pull request changelog entry: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open/Update PR
|
// Open/Update PR
|
||||||
if pr == nil {
|
if pr == nil {
|
||||||
pr, err = releasepr.NewReleasePullRequest(rpBranch, rp.targetBranch, nextVersion, changelogEntryPullRequest)
|
pr, err = releasepr.NewReleasePullRequest(rpBranch, rp.targetBranch, nextVersion, changelogEntry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +308,7 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = pr.SetDescription(changelogEntryPullRequest, overrides)
|
err = pr.SetDescription(changelogEntry, overrides)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue