Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for line breaks when starting a new version from GitHub Actions #940

Merged
merged 6 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ on:
type: string
description: |
iOS changelog: Used for the App Store release notes. If the changelog
is not provided, the deployment for iOS will be skipped.
is not provided, the deployment for iOS will be skipped. Use '\n' for
line breaks.
# For web deployments, we don't have a changelog.
deploy-web-app:
type: boolean
Expand All @@ -34,6 +35,7 @@ on:
description: |
Android changelog: Used for the Google Play Store release notes. If the
changelog is not provided, the deployment for Android will be skipped.
Use '\n' for line breaks.

# Set permissions to none.
#
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ on:
type: string
description: |
iOS changelog: Used for the App Store release notes. If the changelog
is not provided, the deployment for iOS will be skipped.
is not provided, the deployment for iOS will be skipped. Use '\n' for
line breaks.
# For web deployments, we don't have a changelog.
deploy-web-app:
type: boolean
Expand All @@ -34,6 +35,7 @@ on:
description: |
Android changelog: Used for the Google Play Store release notes. If the
changelog is not provided, the deployment for Android will be skipped.
Use '\n' for line breaks.

# Set permissions to none.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ class DeployAndroidCommand extends Command {
// Create folder, if it doesn't exist.
await changelogFile.parent.create(recursive: true);

// When passing the changelog from GitHub Actions to the CLI, the line
// breaks are escaped. We need to replace them with actual line breaks.
final whatsNewWithLineBreaks = whatsNew.replaceAll(r'\n', '\n');

// Write changelog into file. Fastlane will pick it up automatically.
//
// See: https://docs.fastlane.tools/actions/upload_to_play_store/#changelogs-whats-new
await changelogFile.writeAsString(whatsNew);
await changelogFile.writeAsString(whatsNewWithLineBreaks);
}

String _getGooglePlayTrackFromStage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Future<void> publishToAppStoreConnect({
required AppStoreConnectConfig appStoreConnectConfig,
String? whatsNew,
}) async {
// When passing the changelog from GitHub Actions to the CLI, the line breaks
// are escaped. We need to replace them with actual line breaks.
String? whatsNewWithLineBreaks = whatsNew?.replaceAll('\\n', '\n');

final track = _getAppleTrack(
stage: stage,
stageToTracks: stageToTracks,
Expand All @@ -157,9 +161,9 @@ Future<void> publishToAppStoreConnect({
// The app version will be automatically released right after it has
// been approved by App Review.
'AFTER_APPROVAL',
if (whatsNew != null) ...[
if (whatsNewWithLineBreaks != null) ...[
'--whats-new',
whatsNew,
whatsNewWithLineBreaks,
],
if (track is AppStoreTrack) ...[
'--app-store',
Expand Down
Loading