mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
feat: add github action
This commit is contained in:
parent
a1aaa3ba1f
commit
50bf8e0425
4 changed files with 61 additions and 1 deletions
1
.github/workflows/ci.yaml
vendored
1
.github/workflows/ci.yaml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
|||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
25
.github/workflows/releaser-pleaser.yaml
vendored
Normal file
25
.github/workflows/releaser-pleaser.yaml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
name: releaser-pleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, action] # TODO: Remove before merging
|
||||
pull_request:
|
||||
types:
|
||||
- edited
|
||||
- labeled
|
||||
- unlabeled
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
releaser-pleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- run: env
|
||||
- uses: ./
|
||||
24
action.yml
Normal file
24
action.yml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: 'releaser-pleaser'
|
||||
description: 'automated releases based on conventional commits'
|
||||
author: Julian Tölle
|
||||
branding:
|
||||
icon: 'package'
|
||||
color: 'red'
|
||||
inputs:
|
||||
branch:
|
||||
default: main
|
||||
description: "This branch is used as the target for releases."
|
||||
token:
|
||||
description: 'GitHub token for creating and grooming release PRs, defaults to using secrets.GITHUB_TOKEN'
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
outputs: {}
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: ghcr.io/apricote/releaser-pleaser:v0.1.0
|
||||
args:
|
||||
- run
|
||||
- --forge=github
|
||||
- --branch=${{ inputs.branch }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
12
forge.go
12
forge.go
|
|
@ -21,6 +21,7 @@ const (
|
|||
GitHubPRStateClosed = "closed"
|
||||
GitHubEnvAPIToken = "GITHUB_TOKEN"
|
||||
GitHubEnvUsername = "GITHUB_USER"
|
||||
GitHubEnvRepository = "GITHUB_REPOSITORY"
|
||||
GitHubLabelColor = "dedede"
|
||||
)
|
||||
|
||||
|
|
@ -587,7 +588,16 @@ func (g *GitHubOptions) autodiscover() {
|
|||
if username := os.Getenv(GitHubEnvUsername); username != "" {
|
||||
g.Username = username
|
||||
}
|
||||
// TODO: Read settings from GitHub Actions env vars
|
||||
|
||||
if envRepository := os.Getenv(GitHubEnvRepository); envRepository != "" {
|
||||
// GITHUB_REPOSITORY=apricote/releaser-pleaser
|
||||
parts := strings.Split(envRepository, "/")
|
||||
if len(parts) == 2 {
|
||||
g.Owner = parts[0]
|
||||
g.Repo = parts[1]
|
||||
g.Repository = envRepository
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type GitHubOptions struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue