Skip to content

Commit 9da87fd

Browse files
authored
Merge branch 'master' into feat/bip321
2 parents 6478115 + 8b557b6 commit 9da87fd

93 files changed

Lines changed: 12453 additions & 8114 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
head_sha="${1:-HEAD}"
5+
release_kind="${2:?usage: release-pr-title.sh [HEAD_SHA] RELEASE_KIND}"
6+
7+
if [[ "$release_kind" != "release" && "$release_kind" != "prerelease" ]]; then
8+
echo "Release kind must be 'release' or 'prerelease'." >&2
9+
exit 1
10+
fi
11+
12+
ndk_version=$(
13+
git show "$head_sha:packages/ndk/pubspec.yaml" \
14+
| awk '$1 == "version:" { print $2; exit }'
15+
)
16+
if [[ -z "$ndk_version" ]]; then
17+
echo "Could not read the NDK version from $head_sha." >&2
18+
exit 1
19+
fi
20+
21+
pr_title="chore(${release_kind}): publish ndk ${ndk_version}"
22+
echo "$pr_title"
23+
echo "pr_title=$pr_title" >> "$GITHUB_OUTPUT"

.github/workflows/deploy-docs.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
66
workflow_dispatch:
77

8+
concurrency:
9+
group: gh-pages-deploy
10+
cancel-in-progress: false
11+
812
jobs:
913
publish:
1014
name: Publish to gh-pages branch
@@ -15,16 +19,28 @@ jobs:
1519
contents: write
1620

1721
steps:
18-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
23+
24+
- name: Set documentation version from release tag
25+
if: startsWith(github.ref, 'refs/tags/v')
26+
env:
27+
RELEASE_TAG: ${{ github.ref_name }}
28+
run: |
29+
sed -i -E "s/^ label: .*/ label: ${RELEASE_TAG}/" doc/retype.yml
1930
2031
- name: Setup .NET
21-
uses: actions/setup-dotnet@v3
32+
uses: actions/setup-dotnet@v4
2233
with:
2334
dotnet-version: "7.0.x"
2435

25-
- uses: retypeapp/action-build@latest
36+
- name: Build documentation
37+
id: build_docs
38+
uses: retypeapp/action-build@latest
2639

27-
- uses: retypeapp/action-github-pages@latest
40+
- name: Deploy documentation without removing the sample app
41+
uses: peaceiris/actions-gh-pages@v4
2842
with:
29-
update-branch: true
30-
branch: gh-pages
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
publish_dir: ${{ steps.build_docs.outputs.retype-output-path }}
45+
publish_branch: gh-pages
46+
keep_files: true

.github/workflows/deploy-sample-app-web.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ permissions:
3636
contents: write
3737

3838
concurrency:
39-
group: "gh-pages-app"
40-
cancel-in-progress: true
39+
group: gh-pages-deploy
40+
cancel-in-progress: false
4141

4242
env:
4343
FLUTTER_VERSION: "3.47.0"

.github/workflows/prerelease-manual.yaml

Lines changed: 100 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
1-
name: Prepare release manually
1+
name: Prepare package release
22
on:
33
workflow_dispatch:
44
inputs:
5-
prerelease:
6-
description: "Version as prerelease"
5+
release_mode:
6+
description: "How should package versions be selected?"
7+
required: true
8+
default: stable
9+
type: choice
10+
options:
11+
- stable
12+
- development-prerelease
13+
- graduate-prerelease
14+
- exact
15+
exact_package:
16+
description: "Package to version (used only when release mode is exact)"
17+
required: true
18+
default: ndk
19+
type: choice
20+
options:
21+
- ndk
22+
- ndk_drift
23+
- ndk_objectbox
24+
- ndk_flutter
25+
exact_version:
26+
description: "Version such as 0.9.2 (required only when release mode is exact)"
727
required: false
8-
default: false
9-
type: boolean
10-
graduate:
11-
description: "Graduate prereleases to stable"
12-
required: false
13-
default: false
14-
type: boolean
28+
type: string
1529

1630
jobs:
1731
prepare-release:
@@ -38,11 +52,83 @@ jobs:
3852
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
3953
architecture: x64 # optional, x64 or arm64
4054

41-
- name: Run Melos
55+
- name: Configure Git author
56+
run: |
57+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
58+
git config --global user.name "github-actions[bot]"
59+
60+
- name: Prepare automatic version changes
61+
uses: bluefireteam/melos-action@v3
62+
with:
63+
melos-version: "8.3.0"
64+
run-versioning: ${{ inputs.release_mode == 'stable' }}
65+
run-versioning-prerelease: ${{ inputs.release_mode == 'development-prerelease' }}
66+
run-versioning-graduate: ${{ inputs.release_mode == 'graduate-prerelease' }}
67+
publish-dry-run: false
68+
create-pr: false
69+
70+
- name: Validate exact version
71+
if: inputs.release_mode == 'exact'
72+
env:
73+
EXACT_VERSION: ${{ inputs.exact_version }}
74+
run: |
75+
if [ -z "$EXACT_VERSION" ]; then
76+
echo "::error::exact_version is required when release_mode is exact"
77+
exit 1
78+
fi
79+
80+
- name: Set exact package version
81+
if: inputs.release_mode == 'exact'
82+
env:
83+
EXACT_PACKAGE: ${{ inputs.exact_package }}
84+
EXACT_VERSION: ${{ inputs.exact_version }}
85+
run: >
86+
melos version "$EXACT_PACKAGE" "$EXACT_VERSION"
87+
--yes --no-git-tag-version --no-changelog
88+
89+
- name: Add exact release changelog stub
90+
if: inputs.release_mode == 'exact'
91+
env:
92+
EXACT_PACKAGE: ${{ inputs.exact_package }}
93+
EXACT_VERSION: ${{ inputs.exact_version }}
94+
run: |
95+
package_path=$(melos list --json --relative | jq -r \
96+
--arg package "$EXACT_PACKAGE" \
97+
'.[] | select(.name == $package) | .location')
98+
changelog_path="$package_path/CHANGELOG.md"
99+
if [ -z "$package_path" ] || [ ! -f "$changelog_path" ]; then
100+
echo "::error::Could not find CHANGELOG.md for $EXACT_PACKAGE"
101+
exit 1
102+
fi
103+
{
104+
printf '## %s\n\n - Stable release.\n\n' "$EXACT_VERSION"
105+
cat "$changelog_path"
106+
} > "$RUNNER_TEMP/exact-release-changelog.md"
107+
mv "$RUNNER_TEMP/exact-release-changelog.md" "$changelog_path"
108+
git add "$changelog_path"
109+
git commit --amend --no-edit
110+
111+
- name: Keep the documentation version aligned with NDK
112+
run: |
113+
ndk_version=$(awk '$1 == "version:" { print $2; exit }' packages/ndk/pubspec.yaml)
114+
sed -i -E "s/^ label: .*/ label: v${ndk_version}/" doc/retype.yml
115+
116+
if ! git diff --quiet -- doc/retype.yml; then
117+
git add doc/retype.yml
118+
git commit --amend --no-edit
119+
fi
120+
121+
- name: Build versioned release PR title
122+
id: release_pr
123+
env:
124+
RELEASE_KIND: ${{ (inputs.release_mode == 'development-prerelease' || (inputs.release_mode == 'exact' && contains(inputs.exact_version, '-'))) && 'prerelease' || 'release' }}
125+
run: bash .github/scripts/release-pr-title.sh HEAD "$RELEASE_KIND"
126+
127+
- name: Validate and create release PR
42128
uses: bluefireteam/melos-action@v3
43129
with:
44-
run-versioning: ${{ inputs.prerelease == false }}
45-
run-versioning-prerelease: ${{ inputs.prerelease == true }}
46-
run-versioning-graduate: ${{ inputs.graduate == true }}
130+
melos-version: "8.3.0"
131+
run-bootstrap: false
47132
publish-dry-run: true
48133
create-pr: true
134+
pr-title: ${{ steps.release_pr.outputs.pr_title }}

.github/workflows/prerelease-prepare.yaml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ jobs:
2121
prerelease:
2222
name: Create pre-release
2323
runs-on: ubuntu-latest
24-
# Only run if the push wasn't made by the GitHub Action
25-
# Only run if the push wasn't made by the GitHub Action AND doesn't contain release message
26-
if:
27-
github.event.pull_request.merged == true && github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, 'chore(release)')
24+
# github.actor is the person who merged the PR. Check the PR author instead
25+
# so merging the release PR created below cannot create another release PR.
26+
if: >
27+
github.event.pull_request.merged == true &&
28+
github.event.pull_request.user.login != 'github-actions[bot]'
2829
2930
# Add concurrency to prevent parallel runs
3031
concurrency:
@@ -55,13 +56,38 @@ jobs:
5556
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
5657
architecture: x64 # optional, x64 or arm64
5758

58-
- name: Run Melos
59+
- name: Prepare development prerelease changes
5960
uses: bluefireteam/melos-action@v3
6061
with:
6162
run-versioning: false
6263
melos-version: "8.3.0"
6364
run-versioning-prerelease: true
65+
publish-dry-run: false
66+
create-pr: false
67+
git-email: "github-actions[bot]@users.noreply.github.com"
68+
git-name: "github-actions[bot]"
69+
70+
- name: Keep the documentation version aligned with NDK
71+
run: |
72+
ndk_version=$(awk '$1 == "version:" { print $2; exit }' packages/ndk/pubspec.yaml)
73+
sed -i -E "s/^ label: .*/ label: v${ndk_version}/" doc/retype.yml
74+
75+
if ! git diff --quiet -- doc/retype.yml; then
76+
git add doc/retype.yml
77+
git commit --amend --no-edit
78+
fi
79+
80+
- name: Build versioned prerelease PR title
81+
id: release_pr
82+
run: bash .github/scripts/release-pr-title.sh HEAD prerelease
83+
84+
- name: Validate and create development prerelease PR
85+
uses: bluefireteam/melos-action@v3
86+
with:
87+
melos-version: "8.3.0"
88+
run-bootstrap: false
6489
publish-dry-run: true
6590
create-pr: true
91+
pr-title: ${{ steps.release_pr.outputs.pr_title }}
6692
git-email: "github-actions[bot]@users.noreply.github.com"
6793
git-name: "github-actions[bot]"
Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
name: Prerelease - Publish packages
22
on:
3-
# Enable to also publish, when pushing a tag
4-
#push:
5-
# tags:
6-
# - '*'
73
workflow_dispatch:
4+
inputs:
5+
package_name:
6+
description: "Package to publish"
7+
required: true
8+
type: string
9+
package_version:
10+
description: "Package version to publish and tag"
11+
required: true
12+
type: string
13+
commit_sha:
14+
description: "Release commit to publish and tag"
15+
required: true
16+
type: string
817

918
jobs:
1019
publish-packages:
1120
name: Publish packages
1221
permissions:
22+
actions: write
1323
contents: write
1424
id-token: write # Required for authentication using OIDC
1525
runs-on: [ubuntu-latest]
@@ -18,6 +28,7 @@ jobs:
1828
uses: actions/checkout@v4
1929
with:
2030
fetch-depth: 0
31+
ref: ${{ inputs.commit_sha }}
2132
- name: Setup Flutter
2233
uses: subosito/flutter-action@v2
2334
with:
@@ -26,7 +37,33 @@ jobs:
2637
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
2738
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
2839
architecture: x64 # optional, x64 or arm64
29-
- name: Publish packages
40+
- name: Setup Melos
3041
uses: bluefireteam/melos-action@v3
3142
with:
32-
publish: true
43+
melos-version: "8.3.0"
44+
dart-version: none
45+
46+
- name: Setup Dart publishing credentials
47+
uses: dart-lang/setup-dart@v1
48+
with:
49+
sdk: stable
50+
51+
- name: Publish package
52+
env:
53+
PACKAGE_NAME: ${{ inputs.package_name }}
54+
run: melos publish -y --no-dry-run --scope="$PACKAGE_NAME"
55+
56+
- name: Create NDK release tag
57+
if: inputs.package_name == 'ndk'
58+
env:
59+
PACKAGE_VERSION: ${{ inputs.package_version }}
60+
COMMIT_SHA: ${{ inputs.commit_sha }}
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
run: |
63+
release_tag="v$PACKAGE_VERSION"
64+
git config user.email "github-actions[bot]@users.noreply.github.com"
65+
git config user.name "github-actions[bot]"
66+
git tag -a "$release_tag" "$COMMIT_SHA" -m "Release $release_tag"
67+
git push origin "$release_tag"
68+
gh workflow run release.yml --ref "$release_tag"
69+
gh workflow run deploy-docs.yml --ref "$release_tag"

.github/workflows/prerelease-tag.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Tag and start pre-release
1+
name: Start package releases
22
on:
33
push:
44
branches: [master]
55

66
jobs:
77
publish-packages:
8-
name: Create tags for pre-release
8+
name: Start package releases
99

1010
permissions:
1111
actions: write
@@ -26,17 +26,18 @@ jobs:
2626
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
2727
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
2828
architecture: x64 # optional, x64 or arm64
29-
- name: Tag and start pre-release
29+
- name: Setup Melos
3030
uses: bluefireteam/melos-action@v3
3131
with:
32+
melos-version: "8.3.0"
3233
tag: true
33-
# - run: |
34-
# melos exec -c 1 --no-published --no-private --order-dependents -- \
35-
# gh workflow run prerelease-publish.yaml \
36-
# --ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION
37-
- run: |
34+
- name: Publish changed packages
35+
run: |
3836
melos exec -c 1 --no-published --no-private -- \
3937
gh workflow run prerelease-publish.yaml \
40-
--ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION
38+
--ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION \
39+
-f package_name=\$MELOS_PACKAGE_NAME \
40+
-f package_version=\$MELOS_PACKAGE_VERSION \
41+
-f commit_sha=$GITHUB_SHA
4142
env:
42-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)