-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(release): use github app in releases and add pub dev automated pub…
…lishing (#244)
- Loading branch information
1 parent
f6140c6
commit 26ec09e
Showing
4 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,17 +16,32 @@ jobs: | |
|
||
outputs: | ||
tag_name: ${{ steps.read-changelog.outputs.version }} | ||
github-app-token: ${{ steps.app-token.outputs.token }} | ||
|
||
steps: | ||
- name: Generate Token for sbb-app-bakery GH App | ||
id: app-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ vars.APPBAKERYGITHUBAPP_APPID }} | ||
private-key: ${{ secrets.APPBAKERYGITHUBAPP_PRIVATEKEY }} | ||
|
||
- name: Clone Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
persist-credentials: false | ||
|
||
- name: Changelog Reader | ||
id: read-changelog | ||
uses: mindsers/[email protected] | ||
|
||
- name: Create tag | ||
uses: actions4git/[email protected] | ||
with: | ||
github-token: ${{ steps.app-token.outputs.token }} | ||
user-name: sbb-app-bakery[bot] | ||
user-email: 914587+sbb-app-bakery[bot]@users.noreply.github.com | ||
- run: git tag -a ${{ steps.read-changelog.outputs.version }} -m "Version Release ${{ steps.read-changelog.outputs.version }} on ${{ steps.read-changelog.outputs.date }}" | ||
- run: git push --follow-tags | ||
|
||
|
@@ -37,11 +52,13 @@ jobs: | |
- name: Clone Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ needs.create-tag.outputs.github-app-token }} | ||
ref: refs/tags/${{ needs.create-tag.outputs.tag_name }} | ||
persist-credentials: false | ||
|
||
- name: Create GitHub Releases based on changelog | ||
uses: taiki-e/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
token: ${{ needs.create-tag.outputs.github-app-token }} | ||
ref: refs/tags/${{ needs.create-tag.outputs.tag_name }} | ||
changelog: ./CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
name: Make Release PR. | ||
name: Make Release PR | ||
|
||
on: | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
semantic-versioning: | ||
description: Whether to increase major, minor or patch. | ||
required: true | ||
default: 'patch' | ||
default: "patch" | ||
type: choice | ||
options: | ||
- patch | ||
|
@@ -27,11 +27,12 @@ jobs: | |
with: | ||
app-id: ${{ vars.APPBAKERYGITHUBAPP_APPID }} | ||
private-key: ${{ secrets.APPBAKERYGITHUBAPP_PRIVATEKEY }} | ||
|
||
- name: Clone Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
persist-credentials: false | ||
|
||
- name: Update Changelog | ||
id: update-changelog | ||
|
@@ -40,7 +41,7 @@ jobs: | |
command: bump | ||
version: ${{ inputs.semantic-versioning }} | ||
keep-unreleased-section: true | ||
tag-prefix: '' | ||
tag-prefix: "" | ||
|
||
- name: Update Pubspec version | ||
uses: Dbono-dev/[email protected] | ||
|
@@ -49,12 +50,13 @@ jobs: | |
{ | ||
"version": "${{ steps.update-changelog.outputs.version }}" | ||
} | ||
commentOutDevDependencies: 'false' | ||
commentOutDevDependencies: "false" | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
committer: sbb-app-bakery[bot] <914587+sbb-app-bakery[bot]@users.noreply.github.com> | ||
commit-message: ${{ format('Prepare Release for version {0}', steps.update-changelog.outputs.version) }} | ||
branch: ${{ format('release/{0}', steps.update-changelog.outputs.version) }} | ||
title: ${{ format('Auto Release Pull Request {0}', steps.update-changelog.outputs.version) }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Publish to pub.dev | ||
|
||
on: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" # tag pattern on pub.dev: '{{version}}' | ||
|
||
# Publish using custom workflow | ||
jobs: | ||
publish: | ||
permissions: | ||
id-token: write # Required for authentication using OIDC | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
cache: true | ||
- run: flutter doctor -v | ||
- run: flutter pub get | ||
- run: dart run build_runner build --delete-conflicting-outputs | ||
- run: flutter pub publish --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
### Release | ||
|
||
The maintainers of this library can create a release by triggering the `Design System Flutter Release` workflow with the _patch_, _minor_ or _major_ option. This does several things: | ||
##### Release PR | ||
|
||
The maintainers of this library can create a release by triggering the `make-release-pr` | ||
workflow with the _patch_, _minor_ or _major_ option. This does several things: | ||
|
||
1. Update the `pubspec.yaml` to reflect the new version. | ||
2. Update the `CHANGELOG.md` to reflect the new version. | ||
3. Commit and tag these changes in a new commit by the `@github-action[bot]`. | ||
4. Create a GitHub release with the notes from the top `CHANGELOG.md` section (from the `github-release.yml` workflow). | ||
3. Commit and tag these changes in a new commit by the `sbb-app-bakery[bot]`. | ||
4. Create a pull request with these changes with the `autorelease` label. | ||
|
||
##### Github release | ||
|
||
Merging a pull request with the `autorelease` label will trigger the `github-release` workflow that does several things: | ||
|
||
1. Create a tag with the new version from the `CHANGELOG.md`. | ||
2. Make a github release based on the `CHANGELOG.md` and the version of the tag. | ||
|
||
##### Pub Dev release | ||
|
||
The creation of a tag in the `github-release` workflow triggers the `pubdev-release` workflow. This workflow simply | ||
pushes the latest version to pub dev. |