ci: add release-please to automate release creation (#3847)

This commit is contained in:
Matan Kushner 2022-04-11 08:30:11 -05:00 committed by GitHub
parent b3134665e8
commit c96e2736f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 172 deletions

View File

@ -1,49 +0,0 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]
{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}

View File

@ -1,29 +0,0 @@
{{ range .Versions }}
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

View File

@ -1,37 +0,0 @@
---
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/starship/starship
options:
commits: {}
commit_groups:
sort_by: Custom
title_order:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
ci: Continuous Integration
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE

View File

@ -1,36 +0,0 @@
---
style: github
template: RELEASE.tpl.md
info:
repository_url: https://github.com/starship/starship
options:
commits: {}
commit_groups:
sort_by: Custom
title_order:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
ci: Continuous Integration
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE

View File

@ -1,8 +1,8 @@
name: Deploy
on:
push:
tags:
- "v*"
branches:
- master
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
@ -10,9 +10,25 @@ env:
RUSTUP_MAX_RETRIES: 10
jobs:
# Update release PR
release_please:
name: Release Please
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: rust
# Build sources for every OS
github_build:
name: Build release binaries
needs: release_please
if: ${{ needs.release_please.outputs.release_created }}
strategy:
fail-fast: false
matrix:
@ -200,9 +216,9 @@ jobs:
security delete-keychain $KEYCHAIN_PATH
# Create GitHub release with Rust build targets and release notes
github_release:
name: Create GitHub Release
needs: [github_build, notarize_and_pkgbuild]
upload_artifacts:
name: Add Build Artifacts to Release
needs: [release_please, github_build, notarize_and_pkgbuild]
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
@ -210,33 +226,24 @@ jobs:
with:
fetch-depth: 0
- name: Setup | Go
uses: actions/setup-go@v2
with:
go-version: "1.16"
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in starship-*/starship-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Setup | Release notes
run: |
go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.0
git-chglog -c .github/chglog/release.yml $(git describe --tags) > RELEASE.md
- name: Build | Publish
- name: Build | Add Artifacts to Release
uses: softprops/action-gh-release@v1
with:
files: starship-*/starship-*
body_path: RELEASE.md
tag_name: ${{ needs.release_please.outputs.release_created }}
# Publish starship to Crates.io
cargo_publish:
name: Publish Cargo Package
runs-on: ubuntu-latest
needs: github_release
needs: release_please
if: ${{ needs.release_please.outputs.release_created }}
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
@ -254,7 +261,8 @@ jobs:
update_brew_formula:
name: Update Brew Formula
runs-on: ubuntu-latest
needs: github_release
needs: release_please
if: ${{ needs.release_please.outputs.release_created }}
steps:
- uses: mislav/bump-homebrew-formula-action@v1.16
with:
@ -265,7 +273,8 @@ jobs:
publish_docs:
name: Publish docs to Netlify
runs-on: ubuntu-latest
needs: github_release
needs: release_please
if: ${{ needs.release_please.outputs.release_created }}
steps:
- name: Setup | Checkout
uses: actions/checkout@v3

View File

@ -1,4 +1,3 @@
---
name: Format + Docs Workflow
on:
push: