From 4aa1823268f467d1af9d3a3fe905936fa46e6cb3 Mon Sep 17 00:00:00 2001 From: Bart de Lange Date: Fri, 27 Nov 2026 15:51:04 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20feat(config):=20Prepare=20store?= =?UTF-8?q?=20review=20drafts=20after=20tester=20approval?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/code-quality.yml | 2 +- .github/workflows/release-throwl.yaml | 84 +++++++++ CONTRIBUTING.md | 30 +++ apps/throwl/.release-it.json | 6 +- apps/throwl/fastlane/prepare_store_review.rb | 160 ++++++++++++++++ .../fastlane/prepare_store_review_test.rb | 119 ++++++++++++ apps/throwl/package.json | 2 +- apps/throwl/project.json | 2 +- scripts/store-release.mjs | 178 ++++++++++++++++++ scripts/store-release.test.mjs | 99 ++++++++++ scripts/throwl-release.mjs | 62 ++++++ 11 files changed, 739 insertions(+), 5 deletions(-) create mode 100644 apps/throwl/fastlane/prepare_store_review.rb create mode 100644 apps/throwl/fastlane/prepare_store_review_test.rb create mode 100644 scripts/store-release.mjs create mode 100644 scripts/store-release.test.mjs create mode 100644 scripts/throwl-release.mjs diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index eb72246f..efd21a97 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -52,4 +52,4 @@ jobs: run: pnpm test:firestore-rules - name: Verify release artifact encryption - run: node --test scripts/release-artifact.test.mjs + run: node --test scripts/release-artifact.test.mjs scripts/store-release.test.mjs diff --git a/.github/workflows/release-throwl.yaml b/.github/workflows/release-throwl.yaml index e6d12317..bb47c4de 100644 --- a/.github/workflows/release-throwl.yaml +++ b/.github/workflows/release-throwl.yaml @@ -114,3 +114,87 @@ jobs: IOS_APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} IOS_APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} IOS_GOOGLE_SERVICE_INFO_PLIST_B64: ${{ secrets.IOS_GOOGLE_SERVICE_INFO_PLIST_B64 }} + + prepare: + name: Prepare iOS and Android for manual review submission + needs: [deploy_android, deploy_ios] + if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && !github.event.repository.fork + concurrency: + group: throwl-production-store-preparation + cancel-in-progress: false + runs-on: ubuntu-24.04 + environment: store-review + permissions: + actions: read + contents: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Require recorded store-review approval + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/approvals" \ + | jq -e 'any(.[]; .state == "approved" and any(.environments[]; .name == "store-review"))' >/dev/null || { + echo 'Configure required reviewers for the store-review environment and approve this run before preparing the stores.' + exit 1 + } + + - name: Read the tested release and validate its store notes + id: release + env: + GH_TOKEN: ${{ github.token }} + RELEASE_TAG: ${{ github.ref_name }} + run: | + [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo 'Enter a version tag such as v5.1.2.'; exit 1; } + git merge-base --is-ancestor "$GITHUB_SHA" origin/master + gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/releases" \ + | jq -e '[.[][] | select(.tag_name == env.RELEASE_TAG and .draft)] | if length == 1 then .[0] else error("Expected one GitHub draft for this tag") end' \ + > "$RUNNER_TEMP/draft.json" + node scripts/store-release.mjs snapshot "$RUNNER_TEMP/draft.json" "$RUNNER_TEMP/store-release.json" + echo "id=$(jq -er .id "$RUNNER_TEMP/store-release.json")" >> "$GITHUB_OUTPUT" + + - name: Set up Ruby + uses: ruby/setup-ruby@145243922b4465b78e04dd66294782c7de45901f # v1.345.0 + with: + working-directory: apps/throwl + bundler-cache: true + + - name: Verify store preparation safeguards + working-directory: apps/throwl + run: bundle exec ruby fastlane/prepare_store_review_test.rb + + - name: Prepare App Store Connect draft + id: ios + continue-on-error: true + working-directory: apps/throwl + run: bundle exec ruby fastlane/prepare_store_review.rb ios "$RUNNER_TEMP/store-release.json" + env: + DEVELOPER_APP_IDENTIFIER: ${{ secrets.DEVELOPER_APP_IDENTIFIER }} + APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} + APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} + APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} + + - name: Prepare Play Console production release + id: android + continue-on-error: true + working-directory: apps/throwl + run: bundle exec ruby fastlane/prepare_store_review.rb android "$RUNNER_TEMP/store-release.json" + env: + PLAY_CONFIG_JSON: ${{ secrets.PLAY_CONFIG_JSON }} + + - name: Mark the GitHub draft ready when both stores confirm + env: + GH_TOKEN: ${{ github.token }} + RELEASE_ID: ${{ steps.release.outputs.id }} + IOS_OUTCOME: ${{ steps.ios.outcome }} + ANDROID_OUTCOME: ${{ steps.android.outcome }} + run: | + printf '### Store preparation\n\n- iOS: %s\n- Android: %s\n' "$IOS_OUTCOME" "$ANDROID_OUTCOME" >> "$GITHUB_STEP_SUMMARY" + [[ "$IOS_OUTCOME" == success && "$ANDROID_OUTCOME" == success ]] || exit 1 + gh api "repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" > "$RUNNER_TEMP/current-draft.json" + node scripts/store-release.mjs ready "$RUNNER_TEMP/store-release.json" "$RUNNER_TEMP/ready.json" "$RUNNER_TEMP/current-draft.json" + gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" \ + --input "$RUNNER_TEMP/ready.json" --jq .html_url diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10e9bf64..be2790a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,3 +113,33 @@ eligible caches from `master`. To check encrypted bundle creation on GitHub without uploading to the stores, run the release workflow manually with `publish: false`. That run requires release signing and the artifact secret, and retains the encrypted bundles. + +### Prepare production store submissions + +The release target opens `VISUAL` or `EDITOR` for your changelog and store notes +before bumping and tagging the app. It creates a GitHub draft with your text. +For noninteractive use, set `THROWL_RELEASE_NOTES_FILE` to the absolute path to +a Markdown file containing the notes block. Enter `whatsNew` for each store +locale (500 characters maximum) and optional `iosPromotionalText` (170 +characters maximum). +Use an empty string to clear promotional text or omit it to preserve the store's +existing text. You can edit the notes on GitHub before approval. Leave the +status header intact. + +The same tag workflow validates, builds, and uploads both candidate builds, +then waits at **Review deployments**. Test the exact TestFlight and Play +Internal builds before approving `store-review` in that run. + +Before the first release, configure the `store-review` GitHub environment with +required reviewers, allow version tags, and allow self-review if you cut and +approve releases yourself. The job checks the run's approval history before +writing to either store. The App Store Connect key needs permission to manage versions and review +drafts, and the Play service account needs permission to edit production +releases. The workflow reuses the existing Actions credentials. + +The workflow reports each store separately and marks the GitHub draft ready +only after both stores confirm the exact builds are prepared. Submit for +review manually in each store. The workflow leaves the GitHub release in +draft so a maintainer can publish it at the appropriate time. Apple manual +release after approval is set on the prepared version. Use Play managed +publishing if Play should also wait for a manual rollout after review. diff --git a/apps/throwl/.release-it.json b/apps/throwl/.release-it.json index f38c2bc0..f9d6ebb4 100644 --- a/apps/throwl/.release-it.json +++ b/apps/throwl/.release-it.json @@ -5,10 +5,12 @@ }, "git": { "commitMessage": "chore(release): v${version}", - "tagName": "v${version}" + "tagName": "v${version}", + "changelog": "node ../../scripts/store-release.mjs notes" }, "github": { - "release": true + "release": true, + "draft": true }, "hooks": { "after:bump": "nx run throwl:syncNativeVersions --args=\"--version=${version}\"" diff --git a/apps/throwl/fastlane/prepare_store_review.rb b/apps/throwl/fastlane/prepare_store_review.rb new file mode 100644 index 00000000..92f32c8b --- /dev/null +++ b/apps/throwl/fastlane/prepare_store_review.rb @@ -0,0 +1,160 @@ +require 'json' + +module StoreReview + MANUAL_RELEASE = 'MANUAL' + PLAY_DRAFT_STATE = 'RELEASE_LIFECYCLE_STATE_NOT_SENT_FOR_REVIEW' + PLAY_PACKAGE = 'com.throwl' + + def self.prepare_ios(app, api, release) + version_name = release.fetch('version') + build_number = release.fetch('iosBuild') + builds = api::Build.all(app_id: app.id, version: version_name, build_number: build_number, platform: 'IOS') + build = builds.find { |candidate| candidate.processing_state == 'VALID' && !candidate.expired } + raise "iOS #{version_name} build #{build_number} is unavailable or still processing. Check App Store Connect and retry." unless build + + version_filter = { platform: 'IOS', versionString: version_name } + version = app.get_app_store_versions(filter: version_filter, includes: 'build').first + unless version + api.post_app_store_version(app_id: app.id, attributes: { platform: 'IOS', versionString: version_name, releaseType: MANUAL_RELEASE }) + version = app.get_app_store_versions(filter: version_filter, includes: 'build').first + end + raise "Could not read App Store version #{version_name}." unless version + + state = version.app_version_state || version.app_store_state + unless %w[PREPARE_FOR_SUBMISSION READY_FOR_REVIEW].include?(state) + raise "App Store version #{version_name} is #{state}. Resolve its existing review state before retrying." + end + if state == 'READY_FOR_REVIEW' && version.build&.id != build.id + raise 'A different iOS build is already attached to the draft review submission.' + end + version.select_build(build_id: build.id) if version.build&.id != build.id + version.update(attributes: { releaseType: MANUAL_RELEASE }) if version.release_type != MANUAL_RELEASE + + localizations = version.get_app_store_version_localizations + release.fetch('notes').each do |locale, notes| + localization = localizations.find { |item| item.locale == locale } + raise "Configure the #{locale} locale in App Store Connect before retrying." unless localization + + attributes = { whatsNew: notes.fetch('whatsNew') } + attributes[:promotionalText] = notes['iosPromotionalText'] if notes.key?('iosPromotionalText') + if localization.whats_new != attributes[:whatsNew] || + (attributes.key?(:promotionalText) && localization.promotional_text.to_s != attributes[:promotionalText]) + localization.update(attributes: attributes) + end + end + + filter = { platform: 'IOS', state: 'READY_FOR_REVIEW' } + drafts = app.get_review_submissions(filter: filter, includes: 'appStoreVersionForReview,items') + draft = drafts.find do |item| + item.app_store_version_for_review&.id == version.id || + Array(item.items).any? { |entry| entry.app_store_version&.id == version.id } + end + unless draft + # An earlier attempt can leave an empty draft before the version was attached. + raise 'Another iOS review draft exists. Review it in App Store Connect before retrying.' if drafts.any? { |item| item.app_store_version_for_review || !Array(item.items).empty? } + + draft = drafts.first || app.create_review_submission(platform: 'IOS') + draft.add_app_store_version_to_review_items(app_store_version_id: version.id) + end + + confirmed = 6.times.any? do |attempt| + sleep(5) if attempt.positive? + selected = app.get_app_store_versions(filter: version_filter, includes: 'build').first + selected&.build&.id == build.id && + selected.release_type == MANUAL_RELEASE && + (selected.app_version_state || selected.app_store_state) == 'READY_FOR_REVIEW' + end + unless confirmed + raise 'App Store Connect has not confirmed the expected build in a manual review draft. Check the console and retry.' + end + puts "iOS #{version_name} (#{build_number}) is ready for manual submission." + end + + def self.prepare_android(service, api, release) + code = Integer(release.fetch('androidBuild'), 10) + version = release.fetch('version') + production = "applications/#{PLAY_PACKAGE}/tracks/production" + existing = service.list_application_track_releases(production).releases || [] + target = existing.find { |item| Array(item.active_artifacts).any? { |artifact| artifact.version_code.to_i == code } } + if target && target.release_lifecycle_state != PLAY_DRAFT_STATE + raise "Android build #{code} already has a production release in state #{target.release_lifecycle_state}." + end + if existing.any? { |item| item != target && item.release_lifecycle_state != 'RELEASE_LIFECYCLE_STATE_PUBLISHED' } + raise 'Another Google Play production release is pending. Resolve it in Play Console before retrying.' + end + + edit = service.insert_edit(PLAY_PACKAGE) + committed = false + begin + internal = service.get_edit_track(PLAY_PACKAGE, edit.id, 'internal') + unless Array(internal.releases).any? { |item| Array(item.version_codes).map(&:to_i).include?(code) } + raise "Android build #{code} is no longer on Play Internal. Verify the candidate before preparing production." + end + + track = service.get_edit_track(PLAY_PACKAGE, edit.id, 'production') + releases = Array(track.releases) + if releases.any? { |item| %w[inProgress halted].include?(item.status) || Array(item.version_codes).any? { |value| value.to_i > code } } + raise 'A staged, halted or newer Google Play release exists. Resolve it before preparing this candidate.' + end + + notes = release.fetch('notes').map do |locale, entry| + api::LocalizedText.new(language: locale, text: entry.fetch('whatsNew')) + end + target_release = api::TrackRelease.new(name: version, version_codes: [code], release_notes: notes, status: 'completed') + service.update_edit_track(PLAY_PACKAGE, edit.id, 'production', api::Track.new(track: 'production', releases: [target_release])) + service.validate_edit(PLAY_PACKAGE, edit.id) + # Never fall back to Fastlane's automatic commit retry or omit either guard. + service.commit_edit(PLAY_PACKAGE, edit.id, changes_not_sent_for_review: true, changes_in_review_behavior: 'ERROR_IF_IN_REVIEW') + committed = true + ensure + unless committed + begin + service.delete_edit(PLAY_PACKAGE, edit.id) + rescue Google::Apis::Error + # Expired or concurrently invalidated edits need no further cleanup. + end + end + end + + saved = 6.times.any? do |attempt| + sleep(5) if attempt.positive? + Array(service.list_application_track_releases(production).releases).any? do |item| + item.release_name == version && + item.release_lifecycle_state == PLAY_DRAFT_STATE && + Array(item.active_artifacts).map { |artifact| artifact.version_code.to_i } == [code] + end + end + raise "Play Console has not confirmed Android build #{code} is waiting for manual review submission. Check Publishing overview." unless saved + + puts "Android #{version} (#{code}) is ready for manual submission." + end +end + +if $PROGRAM_NAME == __FILE__ + platform, path = ARGV + release = JSON.parse(File.read(path)) + case platform + when 'ios' + require 'spaceship' + api = Spaceship::ConnectAPI + api.token = api::Token.create(key_id: ENV.fetch('APPLE_KEY_ID'), issuer_id: ENV.fetch('APPLE_ISSUER_ID'), key: ENV.fetch('APPLE_KEY_CONTENT')) + app = api::App.find(ENV.fetch('DEVELOPER_APP_IDENTIFIER')) + raise 'App Store Connect app was not found.' unless app + + StoreReview.prepare_ios(app, api, release) + when 'android' + require 'base64' + require 'google/apis/androidpublisher_v3' + require 'googleauth' + require 'stringio' + api = Google::Apis::AndroidpublisherV3 + service = api::AndroidPublisherService.new + service.authorization = Google::Auth::ServiceAccountCredentials.make_creds( + json_key_io: StringIO.new(Base64.strict_decode64(ENV.fetch('PLAY_CONFIG_JSON'))), + scope: api::AUTH_ANDROIDPUBLISHER + ) + StoreReview.prepare_android(service, api, release) + else + raise 'Expected ios or android.' + end +end diff --git a/apps/throwl/fastlane/prepare_store_review_test.rb b/apps/throwl/fastlane/prepare_store_review_test.rb new file mode 100644 index 00000000..6f64a3c6 --- /dev/null +++ b/apps/throwl/fastlane/prepare_store_review_test.rb @@ -0,0 +1,119 @@ +require 'minitest/autorun' +require 'ostruct' +require 'google/apis/androidpublisher_v3' +require_relative 'prepare_store_review' + +class StoreReviewTest < Minitest::Test + Play = Google::Apis::AndroidpublisherV3 + Release = { + 'version' => '5.1.2', + 'iosBuild' => '7', + 'androidBuild' => '45', + 'notes' => { 'en-US' => { 'whatsNew' => 'Team games', 'iosPromotionalText' => 'Play as a team' } } + }.freeze + + class PlayService + attr_reader :commit_options, :production, :edit_deleted + + def initialize(internal_code) + @internal_code = internal_code + end + + def list_application_track_releases(_track) + releases = if commit_options + [OpenStruct.new( + release_name: '5.1.2', release_lifecycle_state: StoreReview::PLAY_DRAFT_STATE, + active_artifacts: [OpenStruct.new(version_code: 45)] + )] + else + [] + end + OpenStruct.new(releases: releases) + end + + def insert_edit(_package) + OpenStruct.new(id: 'test-edit') + end + + def get_edit_track(_package, _edit, track) + Play::Track.new(releases: [Play::TrackRelease.new( + status: 'completed', version_codes: [track == 'internal' ? @internal_code : 44] + )]) + end + + def update_edit_track(_package, _edit, _track, production) + @production = production + end + + def validate_edit(_package, _edit); end + + def commit_edit(_package, _edit, **options) + @commit_options = options + end + + def delete_edit(_package, _edit) + @edit_deleted = true + end + end + + def test_play_prepares_exact_internal_bundle_and_does_not_send_it_for_review + service = PlayService.new(45) + StoreReview.prepare_android(service, Play, Release) + + candidate = service.production.releases.fetch(0) + assert_equal [45], candidate.version_codes + assert_equal 'Team games', candidate.release_notes.fetch(0).text + assert_equal({ + changes_not_sent_for_review: true, + changes_in_review_behavior: 'ERROR_IF_IN_REVIEW' + }, service.commit_options) + end + + def test_play_leaves_production_alone_when_the_requested_internal_bundle_is_missing + service = PlayService.new(46) + assert_raises(RuntimeError, /no longer on Play Internal/) do + StoreReview.prepare_android(service, Play, Release) + end + assert_nil service.production + assert_nil service.commit_options + assert service.edit_deleted + end + + def test_apple_attaches_the_tested_build_and_prepares_a_draft_without_submitting + build = OpenStruct.new(id: 'beta-build', processing_state: 'VALID', expired: false) + builder = Object.new + builder.define_singleton_method(:all) do |**options| + raise 'Wrong iOS build lookup' unless options == { app_id: 'app', version: '5.1.2', build_number: '7', platform: 'IOS' } + + [build] + end + api = Module.new + api.const_set(:Build, builder) + localization = OpenStruct.new(locale: 'en-US') + localization.define_singleton_method(:update) do |attributes:| + self.whats_new = attributes.fetch(:whatsNew) + self.promotional_text = attributes.fetch(:promotionalText) + end + version = OpenStruct.new(id: 'version', app_version_state: 'PREPARE_FOR_SUBMISSION') + version.define_singleton_method(:select_build) { |build_id:| self.build = build if build.id == build_id } + version.define_singleton_method(:update) { |attributes:| self.release_type = attributes.fetch(:releaseType) } + version.define_singleton_method(:get_app_store_version_localizations) { [localization] } + + draft = Object.new + draft.define_singleton_method(:add_app_store_version_to_review_items) do |app_store_version_id:| + version.app_version_state = 'READY_FOR_REVIEW' if app_store_version_id == version.id + end + app = OpenStruct.new(id: 'app') + app.define_singleton_method(:get_app_store_versions) { |**| [version] } + app.define_singleton_method(:get_review_submissions) { |**| [] } + app.define_singleton_method(:create_review_submission) { |platform:| draft if platform == 'IOS' } + + StoreReview.prepare_ios(app, api, Release) + + assert_equal 'beta-build', version.build.id + assert_equal 'MANUAL', version.release_type + assert_equal 'Team games', localization.whats_new + assert_equal 'Play as a team', localization.promotional_text + assert_equal 'READY_FOR_REVIEW', version.app_version_state + end +end diff --git a/apps/throwl/package.json b/apps/throwl/package.json index bf0e3b9b..b40b78ba 100644 --- a/apps/throwl/package.json +++ b/apps/throwl/package.json @@ -3,7 +3,7 @@ "version": "5.1.1", "private": true, "scripts": { - "release": "release-it" + "release": "node ../../scripts/throwl-release.mjs" }, "dependencies": { "@freakycoder/react-native-helpers": "^2.5.1", diff --git a/apps/throwl/project.json b/apps/throwl/project.json index bece2569..833b98a1 100644 --- a/apps/throwl/project.json +++ b/apps/throwl/project.json @@ -98,7 +98,7 @@ "executor": "nx:run-commands", "options": { "cwd": "{projectRoot}", - "command": "release-it" + "command": "pnpm run release" } }, "deploy:android": { diff --git a/scripts/store-release.mjs b/scripts/store-release.mjs new file mode 100644 index 00000000..19e59897 --- /dev/null +++ b/scripts/store-release.mjs @@ -0,0 +1,178 @@ +import { execFileSync } from 'node:child_process'; +import { readFile, writeFile } from 'node:fs/promises'; +import { pathToFileURL } from 'node:url'; + +const pending = ''; +const ready = ''; +const readyText = + '**Both stores are ready to submit.** Open App Store Connect and Play Console to send each release for review.'; + +function singleMatch(text, pattern, message) { + const matches = [...text.matchAll(pattern)]; + if (matches.length !== 1) throw new Error(message); + return matches[0][1]; +} + +export function readStoreNotes(body) { + const json = singleMatch( + body, + /\r?\n```json\r?\n([\s\S]*?)\r?\n```/g, + 'Keep exactly one store-notes JSON block in the GitHub draft.', + ); + const notes = JSON.parse(json); + if (!notes?.['en-US'] || Array.isArray(notes)) { + throw new Error('Store notes must include en-US.'); + } + + for (const [locale, entry] of Object.entries(notes)) { + if ( + !/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(locale) || + !entry || + typeof entry !== 'object' + ) { + throw new Error(`Invalid store locale or entry: ${locale}`); + } + const text = entry.whatsNew; + if (typeof text !== 'string' || !text.trim() || [...text].length > 500) { + throw new Error(`${locale} What’s New must contain 1–500 characters.`); + } + if ( + entry.iosPromotionalText !== undefined && + (typeof entry.iosPromotionalText !== 'string' || + [...entry.iosPromotionalText].length > 170) + ) { + throw new Error( + `${locale} iOS promotional text must be at most 170 characters.`, + ); + } + } + return notes; +} + +export function readReleaseIdentity(tag, appVersion, gradle, xcode) { + if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag !== `v${appVersion}`) { + throw new Error('The release tag and app package version must match.'); + } + const androidBuild = singleMatch( + gradle, + /^\s*versionCode\s+(\d+)\s*$/gm, + 'Expected one Android version code.', + ); + const androidVersion = singleMatch( + gradle, + /^\s*versionName\s+"([^"]+)"\s*$/gm, + 'Expected one Android version name.', + ); + const iosBuilds = [ + ...new Set( + [...xcode.matchAll(/^\s*CURRENT_PROJECT_VERSION\s*=\s*(\d+);\s*$/gm)].map( + (match) => match[1], + ), + ), + ]; + if (iosBuilds.length !== 1) throw new Error('iOS build numbers must agree.'); + const iosVersions = [ + ...new Set( + [...xcode.matchAll(/^\s*MARKETING_VERSION\s*=\s*([\d.]+);\s*$/gm)].map( + (match) => match[1], + ), + ), + ]; + if ( + androidVersion !== appVersion || + iosVersions.length !== 1 || + iosVersions[0] !== appVersion + ) { + throw new Error( + 'The native marketing versions must match the tagged app version.', + ); + } + return { version: appVersion, androidBuild, iosBuild: iosBuilds[0] }; +} + +const pendingText = + '**Production review drafts have not been prepared.** Test the uploaded builds, then run Prepare store submissions.'; + +const pendingHeader = `${pending}\n${pendingText}`; +const readyHeader = `${ready}\n${readyText}`; + +export function withDraftStatus(body) { + return body.startsWith(pendingHeader) ? body : `${pendingHeader}\n\n${body}`; +} + +export function draftTemplate() { + return withDraftStatus(`## Changes + + +\`\`\`json +{ + "en-US": { + "whatsNew": "", + "iosPromotionalText": "" + } +} +\`\`\` + +`); +} + +export function markReady(body) { + if (body.startsWith(readyHeader)) return body; + if (!body.startsWith(pendingHeader)) { + throw new Error('The draft is missing its store status header.'); + } + return readyHeader + body.slice(pendingHeader.length); +} + +if ( + process.argv[1] && + import.meta.url === pathToFileURL(process.argv[1]).href +) { + const [command, source, output] = process.argv.slice(2); + if (command === 'notes') { + process.stdout.write( + await readFile(process.env.THROWL_RELEASE_NOTES_FILE, 'utf8'), + ); + } else if (command === 'snapshot') { + const release = JSON.parse(await readFile(source, 'utf8')); + if (!release.draft || release.tag_name !== process.env.RELEASE_TAG) { + throw new Error( + 'Expected the GitHub draft for the selected release tag.', + ); + } + markReady(release.body); + if (!/^v\d+\.\d+\.\d+$/.test(release.tag_name)) { + throw new Error('Expected a version tag such as v5.1.2.'); + } + const taggedFile = (path) => + execFileSync('git', ['show', `refs/tags/${release.tag_name}:${path}`], { + encoding: 'utf8', + }); + const identity = readReleaseIdentity( + release.tag_name, + JSON.parse(taggedFile('apps/throwl/package.json')).version, + taggedFile('apps/throwl/android/app/build.gradle'), + taggedFile('apps/throwl/ios/Throwl.xcodeproj/project.pbxproj'), + ); + await writeFile( + output, + JSON.stringify({ + ...identity, + id: release.id, + body: release.body, + notes: readStoreNotes(release.body), + }), + ); + } else if (command === 'ready') { + const snapshot = JSON.parse(await readFile(source, 'utf8')); + const current = JSON.parse(await readFile(process.argv[5], 'utf8')); + if (!current.draft || current.body !== snapshot.body) { + throw new Error( + 'The GitHub draft changed during preparation. Rerun with the current notes.', + ); + } + await writeFile(output, JSON.stringify({ body: markReady(snapshot.body) })); + } else { + throw new Error('Expected notes, snapshot or ready.'); + } +} diff --git a/scripts/store-release.test.mjs b/scripts/store-release.test.mjs new file mode 100644 index 00000000..44f802f1 --- /dev/null +++ b/scripts/store-release.test.mjs @@ -0,0 +1,99 @@ +import assert from 'node:assert/strict'; +import { test } from 'node:test'; +import { + draftTemplate, + markReady, + readReleaseIdentity, + readStoreNotes, +} from './store-release.mjs'; + +test('store notes come from the dedicated block and the GitHub changelog stays intact', () => { + const original = draftTemplate().replace( + '## Changes', + '## Changes\nUpdated the scoreboard.', + ); + assert.throws(() => readStoreNotes(original), /What’s New/); + const edited = original.replace('"whatsNew": ""', '"whatsNew": "Team games"'); + assert.deepEqual(readStoreNotes(edited), { + 'en-US': { whatsNew: 'Team games', iosPromotionalText: '' }, + }); + assert.throws( + () => readStoreNotes(edited.replace('Team games', '🎯'.repeat(501))), + /500 characters/, + ); + assert.throws( + () => + readStoreNotes( + edited.replace( + '"iosPromotionalText": ""', + `"iosPromotionalText": "${'a'.repeat(171)}"`, + ), + ), + /170 characters/, + ); + const ready = markReady(edited); + assert.match(ready, /Both stores are ready/); + assert.match(ready, /Updated the scoreboard/); + assert.deepEqual(readStoreNotes(ready), readStoreNotes(edited)); + assert.equal(markReady(ready), ready); +}); + +test('the expected release identity uses platform build numbers from the tag', () => { + const gradle = 'versionCode 45\nversionName "5.1.2"'; + const xcode = 'CURRENT_PROJECT_VERSION = 7;\nMARKETING_VERSION = 5.1.2;'; + assert.deepEqual(readReleaseIdentity('v5.1.2', '5.1.2', gradle, xcode), { + version: '5.1.2', + androidBuild: '45', + iosBuild: '7', + }); + assert.throws( + () => readReleaseIdentity('v5.1.3', '5.1.2', gradle, xcode), + /must match/, + ); + assert.throws( + () => + readReleaseIdentity( + 'v5.1.2', + '5.1.2', + gradle, + xcode.replace('5.1.2', '5.1.1'), + ), + /marketing versions/, + ); +}); + +test('the release wrapper forwards authored notes to release-it', async (t) => { + const { spawnSync } = await import('node:child_process'); + const { mkdtemp, rm, writeFile } = await import('node:fs/promises'); + const { tmpdir } = await import('node:os'); + const { delimiter, join } = await import('node:path'); + const { fileURLToPath } = await import('node:url'); + const directory = await mkdtemp(join(tmpdir(), 'throwl-authored-notes-')); + t.after(() => rm(directory, { recursive: true, force: true })); + + const path = join(directory, 'notes.md'); + const notes = draftTemplate() + .replace('## Changes', '## Changes\nYour teammate can now check out.') + .replace('"whatsNew": ""', '"whatsNew": "Play together."'); + await writeFile(path, notes); + await writeFile( + join(directory, 'release-it'), + '#!/bin/sh\nprintf "%s\\n" "$@"\ncat "$THROWL_RELEASE_NOTES_FILE"\n', + { mode: 0o700 }, + ); + + const script = fileURLToPath( + new URL('./throwl-release.mjs', import.meta.url), + ); + const result = spawnSync(process.execPath, [script, 'patch', '--dry-run'], { + encoding: 'utf8', + env: { + ...process.env, + PATH: directory + delimiter + process.env.PATH, + THROWL_RELEASE_NOTES_FILE: path, + GITHUB_TOKEN: 'test-only-token', + }, + }); + assert.equal(result.status, 0, result.stderr); + assert.equal(result.stdout, 'patch\n--dry-run\n' + notes); +}); diff --git a/scripts/throwl-release.mjs b/scripts/throwl-release.mjs new file mode 100644 index 00000000..ca53a6d7 --- /dev/null +++ b/scripts/throwl-release.mjs @@ -0,0 +1,62 @@ +import { execFileSync, spawnSync } from 'node:child_process'; +import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join, resolve } from 'node:path'; +import { + draftTemplate, + readStoreNotes, + withDraftStatus, +} from './store-release.mjs'; + +const directory = await mkdtemp(join(tmpdir(), 'throwl-release-')); +try { + const suppliedNotes = process.env.THROWL_RELEASE_NOTES_FILE; + const notesPath = suppliedNotes + ? resolve(suppliedNotes) + : join(directory, 'release-notes.md'); + if (!suppliedNotes) { + if (!process.stdin.isTTY) { + throw new Error( + 'Run the release in an interactive terminal or set THROWL_RELEASE_NOTES_FILE.', + ); + } + await writeFile(notesPath, draftTemplate()); + const editor = process.env.VISUAL || process.env.EDITOR || 'vi'; + execFileSync( + 'sh', + ['-c', `exec ${editor} "$1"`, 'release-editor', notesPath], + { + stdio: 'inherit', + }, + ); + } + + const body = await readFile(notesPath, 'utf8'); + readStoreNotes(body); + const draftPath = join(directory, 'draft.md'); + await writeFile(draftPath, withDraftStatus(body)); + + const token = + process.env.GITHUB_TOKEN || + execFileSync('gh', ['auth', 'token'], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'ignore'], + }).trim(); + if (!token) + throw new Error( + 'Authenticate with gh or set GITHUB_TOKEN before releasing.', + ); + + const result = spawnSync('release-it', process.argv.slice(2), { + stdio: 'inherit', + env: { + ...process.env, + GITHUB_TOKEN: token, + THROWL_RELEASE_NOTES_FILE: draftPath, + }, + }); + if (result.error) throw result.error; + process.exitCode = result.status ?? 1; +} finally { + await rm(directory, { recursive: true, force: true }); +} From 88b440d4e3948e8e3b2f6a7c1373b6afed1d350c Mon Sep 17 00:00:00 2001 From: Bart de Lange Date: Fri, 27 Nov 2026 15:56:06 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A7=B9=20chore(config):=20Edit=20rele?= =?UTF-8?q?ase=20notes=20directly=20in=20the=20GitHub=20draft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 20 +++--- apps/throwl/.release-it.json | 2 +- apps/throwl/fastlane/store-release-notes.md | 18 ++++++ apps/throwl/package.json | 2 +- apps/throwl/project.json | 2 +- scripts/store-release.mjs | 70 +++++---------------- scripts/store-release.test.mjs | 47 +++----------- scripts/throwl-release.mjs | 62 ------------------ 8 files changed, 56 insertions(+), 167 deletions(-) create mode 100644 apps/throwl/fastlane/store-release-notes.md delete mode 100644 scripts/throwl-release.mjs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be2790a7..22edbaf2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,15 +116,17 @@ release signing and the artifact secret, and retains the encrypted bundles. ### Prepare production store submissions -The release target opens `VISUAL` or `EDITOR` for your changelog and store notes -before bumping and tagging the app. It creates a GitHub draft with your text. -For noninteractive use, set `THROWL_RELEASE_NOTES_FILE` to the absolute path to -a Markdown file containing the notes block. Enter `whatsNew` for each store -locale (500 characters maximum) and optional `iosPromotionalText` (170 -characters maximum). -Use an empty string to clear promotional text or omit it to preserve the store's -existing text. You can edit the notes on GitHub before approval. Leave the -status header intact. +Run the usual release target with a GitHub token so release-it creates a +draft directly: + +```sh +GITHUB_TOKEN="$(gh auth token)" pnpm nx run @throwl/throwl:release +``` + +On GitHub, edit the draft's changelog and store notes before approving. +Enter `whatsNew` (up to 500 characters per locale) and optional +`iosPromotionalText` (up to 170 characters). Omit the promotional text field to +preserve existing text or use an empty string to clear it. The same tag workflow validates, builds, and uploads both candidate builds, then waits at **Review deployments**. Test the exact TestFlight and Play diff --git a/apps/throwl/.release-it.json b/apps/throwl/.release-it.json index f9d6ebb4..2d39157b 100644 --- a/apps/throwl/.release-it.json +++ b/apps/throwl/.release-it.json @@ -6,7 +6,7 @@ "git": { "commitMessage": "chore(release): v${version}", "tagName": "v${version}", - "changelog": "node ../../scripts/store-release.mjs notes" + "changelog": "cat fastlane/store-release-notes.md" }, "github": { "release": true, diff --git a/apps/throwl/fastlane/store-release-notes.md b/apps/throwl/fastlane/store-release-notes.md new file mode 100644 index 00000000..02235f36 --- /dev/null +++ b/apps/throwl/fastlane/store-release-notes.md @@ -0,0 +1,18 @@ + + +**Production review drafts have not been prepared.** Add the release notes, test both builds, and approve the workflow. + +## Changes + +Add the changelog here. + + + +```json +{ + "en-US": { + "whatsNew": "", + "iosPromotionalText": "" + } +} +``` diff --git a/apps/throwl/package.json b/apps/throwl/package.json index b40b78ba..bf0e3b9b 100644 --- a/apps/throwl/package.json +++ b/apps/throwl/package.json @@ -3,7 +3,7 @@ "version": "5.1.1", "private": true, "scripts": { - "release": "node ../../scripts/throwl-release.mjs" + "release": "release-it" }, "dependencies": { "@freakycoder/react-native-helpers": "^2.5.1", diff --git a/apps/throwl/project.json b/apps/throwl/project.json index 833b98a1..bece2569 100644 --- a/apps/throwl/project.json +++ b/apps/throwl/project.json @@ -98,7 +98,7 @@ "executor": "nx:run-commands", "options": { "cwd": "{projectRoot}", - "command": "pnpm run release" + "command": "release-it" } }, "deploy:android": { diff --git a/scripts/store-release.mjs b/scripts/store-release.mjs index 19e59897..49e95a1a 100644 --- a/scripts/store-release.mjs +++ b/scripts/store-release.mjs @@ -1,11 +1,8 @@ -import { execFileSync } from 'node:child_process'; import { readFile, writeFile } from 'node:fs/promises'; import { pathToFileURL } from 'node:url'; -const pending = ''; -const ready = ''; -const readyText = - '**Both stores are ready to submit.** Open App Store Connect and Play Console to send each release for review.'; +const ready = + '\n**Both stores are ready to submit.** Open App Store Connect and Play Console to send each release for review.'; function singleMatch(text, pattern, message) { const matches = [...text.matchAll(pattern)]; @@ -16,7 +13,7 @@ function singleMatch(text, pattern, message) { export function readStoreNotes(body) { const json = singleMatch( body, - /\r?\n```json\r?\n([\s\S]*?)\r?\n```/g, + /\s*```json\r?\n([\s\S]*?)\r?\n```/g, 'Keep exactly one store-notes JSON block in the GitHub draft.', ); const notes = JSON.parse(json); @@ -90,38 +87,12 @@ export function readReleaseIdentity(tag, appVersion, gradle, xcode) { return { version: appVersion, androidBuild, iosBuild: iosBuilds[0] }; } -const pendingText = - '**Production review drafts have not been prepared.** Test the uploaded builds, then run Prepare store submissions.'; - -const pendingHeader = `${pending}\n${pendingText}`; -const readyHeader = `${ready}\n${readyText}`; - -export function withDraftStatus(body) { - return body.startsWith(pendingHeader) ? body : `${pendingHeader}\n\n${body}`; -} - -export function draftTemplate() { - return withDraftStatus(`## Changes - - -\`\`\`json -{ - "en-US": { - "whatsNew": "", - "iosPromotionalText": "" - } -} -\`\`\` - -`); -} - export function markReady(body) { - if (body.startsWith(readyHeader)) return body; - if (!body.startsWith(pendingHeader)) { - throw new Error('The draft is missing its store status header.'); - } - return readyHeader + body.slice(pendingHeader.length); + const notes = body.replace( + /^\s*(?:\*\*(?:Production review drafts have not been prepared|Both stores are ready to submit)\.\*\*[^\r\n]*\s*)?/, + '', + ); + return `${ready}\n\n${notes}`; } if ( @@ -129,30 +100,21 @@ if ( import.meta.url === pathToFileURL(process.argv[1]).href ) { const [command, source, output] = process.argv.slice(2); - if (command === 'notes') { - process.stdout.write( - await readFile(process.env.THROWL_RELEASE_NOTES_FILE, 'utf8'), - ); - } else if (command === 'snapshot') { + if (command === 'snapshot') { const release = JSON.parse(await readFile(source, 'utf8')); if (!release.draft || release.tag_name !== process.env.RELEASE_TAG) { throw new Error( 'Expected the GitHub draft for the selected release tag.', ); } - markReady(release.body); - if (!/^v\d+\.\d+\.\d+$/.test(release.tag_name)) { - throw new Error('Expected a version tag such as v5.1.2.'); - } - const taggedFile = (path) => - execFileSync('git', ['show', `refs/tags/${release.tag_name}:${path}`], { - encoding: 'utf8', - }); const identity = readReleaseIdentity( release.tag_name, - JSON.parse(taggedFile('apps/throwl/package.json')).version, - taggedFile('apps/throwl/android/app/build.gradle'), - taggedFile('apps/throwl/ios/Throwl.xcodeproj/project.pbxproj'), + JSON.parse(await readFile('apps/throwl/package.json', 'utf8')).version, + await readFile('apps/throwl/android/app/build.gradle', 'utf8'), + await readFile( + 'apps/throwl/ios/Throwl.xcodeproj/project.pbxproj', + 'utf8', + ), ); await writeFile( output, @@ -173,6 +135,6 @@ if ( } await writeFile(output, JSON.stringify({ body: markReady(snapshot.body) })); } else { - throw new Error('Expected notes, snapshot or ready.'); + throw new Error('Expected snapshot or ready.'); } } diff --git a/scripts/store-release.test.mjs b/scripts/store-release.test.mjs index 44f802f1..b955a523 100644 --- a/scripts/store-release.test.mjs +++ b/scripts/store-release.test.mjs @@ -1,14 +1,18 @@ import assert from 'node:assert/strict'; import { test } from 'node:test'; +import { readFile } from 'node:fs/promises'; import { - draftTemplate, markReady, readReleaseIdentity, readStoreNotes, } from './store-release.mjs'; -test('store notes come from the dedicated block and the GitHub changelog stays intact', () => { - const original = draftTemplate().replace( +test('store notes come from the dedicated block and the GitHub changelog stays intact', async () => { + const template = await readFile( + new URL('../apps/throwl/fastlane/store-release-notes.md', import.meta.url), + 'utf8', + ); + const original = template.replace( '## Changes', '## Changes\nUpdated the scoreboard.', ); @@ -33,6 +37,7 @@ test('store notes come from the dedicated block and the GitHub changelog stays i ); const ready = markReady(edited); assert.match(ready, /Both stores are ready/); + assert.doesNotMatch(ready, /Production review drafts have not been prepared/); assert.match(ready, /Updated the scoreboard/); assert.deepEqual(readStoreNotes(ready), readStoreNotes(edited)); assert.equal(markReady(ready), ready); @@ -61,39 +66,3 @@ test('the expected release identity uses platform build numbers from the tag', ( /marketing versions/, ); }); - -test('the release wrapper forwards authored notes to release-it', async (t) => { - const { spawnSync } = await import('node:child_process'); - const { mkdtemp, rm, writeFile } = await import('node:fs/promises'); - const { tmpdir } = await import('node:os'); - const { delimiter, join } = await import('node:path'); - const { fileURLToPath } = await import('node:url'); - const directory = await mkdtemp(join(tmpdir(), 'throwl-authored-notes-')); - t.after(() => rm(directory, { recursive: true, force: true })); - - const path = join(directory, 'notes.md'); - const notes = draftTemplate() - .replace('## Changes', '## Changes\nYour teammate can now check out.') - .replace('"whatsNew": ""', '"whatsNew": "Play together."'); - await writeFile(path, notes); - await writeFile( - join(directory, 'release-it'), - '#!/bin/sh\nprintf "%s\\n" "$@"\ncat "$THROWL_RELEASE_NOTES_FILE"\n', - { mode: 0o700 }, - ); - - const script = fileURLToPath( - new URL('./throwl-release.mjs', import.meta.url), - ); - const result = spawnSync(process.execPath, [script, 'patch', '--dry-run'], { - encoding: 'utf8', - env: { - ...process.env, - PATH: directory + delimiter + process.env.PATH, - THROWL_RELEASE_NOTES_FILE: path, - GITHUB_TOKEN: 'test-only-token', - }, - }); - assert.equal(result.status, 0, result.stderr); - assert.equal(result.stdout, 'patch\n--dry-run\n' + notes); -}); diff --git a/scripts/throwl-release.mjs b/scripts/throwl-release.mjs deleted file mode 100644 index ca53a6d7..00000000 --- a/scripts/throwl-release.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import { execFileSync, spawnSync } from 'node:child_process'; -import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; -import { tmpdir } from 'node:os'; -import { join, resolve } from 'node:path'; -import { - draftTemplate, - readStoreNotes, - withDraftStatus, -} from './store-release.mjs'; - -const directory = await mkdtemp(join(tmpdir(), 'throwl-release-')); -try { - const suppliedNotes = process.env.THROWL_RELEASE_NOTES_FILE; - const notesPath = suppliedNotes - ? resolve(suppliedNotes) - : join(directory, 'release-notes.md'); - if (!suppliedNotes) { - if (!process.stdin.isTTY) { - throw new Error( - 'Run the release in an interactive terminal or set THROWL_RELEASE_NOTES_FILE.', - ); - } - await writeFile(notesPath, draftTemplate()); - const editor = process.env.VISUAL || process.env.EDITOR || 'vi'; - execFileSync( - 'sh', - ['-c', `exec ${editor} "$1"`, 'release-editor', notesPath], - { - stdio: 'inherit', - }, - ); - } - - const body = await readFile(notesPath, 'utf8'); - readStoreNotes(body); - const draftPath = join(directory, 'draft.md'); - await writeFile(draftPath, withDraftStatus(body)); - - const token = - process.env.GITHUB_TOKEN || - execFileSync('gh', ['auth', 'token'], { - encoding: 'utf8', - stdio: ['ignore', 'pipe', 'ignore'], - }).trim(); - if (!token) - throw new Error( - 'Authenticate with gh or set GITHUB_TOKEN before releasing.', - ); - - const result = spawnSync('release-it', process.argv.slice(2), { - stdio: 'inherit', - env: { - ...process.env, - GITHUB_TOKEN: token, - THROWL_RELEASE_NOTES_FILE: draftPath, - }, - }); - if (result.error) throw result.error; - process.exitCode = result.status ?? 1; -} finally { - await rm(directory, { recursive: true, force: true }); -} From 46874adecba42e1334149ca42598dd6f8e12bb4d Mon Sep 17 00:00:00 2001 From: Bart de Lange Date: Fri, 27 Nov 2026 16:05:20 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=A7=B9=20chore(config):=20Trim=20rele?= =?UTF-8?q?ase=20tooling=20and=20remove=20script=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/code-quality.yml | 3 - .github/workflows/release-throwl.yaml | 4 - apps/throwl/fastlane/prepare_store_review.rb | 13 +- .../fastlane/prepare_store_review_test.rb | 119 ----------- package.json | 1 - scripts/clone-firestore-data.test.mjs | 57 ------ scripts/release-artifact.test.mjs | 52 ----- scripts/store-release.mjs | 192 ++++++++---------- scripts/store-release.test.mjs | 68 ------- 9 files changed, 95 insertions(+), 414 deletions(-) delete mode 100644 apps/throwl/fastlane/prepare_store_review_test.rb delete mode 100644 scripts/clone-firestore-data.test.mjs delete mode 100644 scripts/release-artifact.test.mjs delete mode 100644 scripts/store-release.test.mjs diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index efd21a97..f740c5a2 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -50,6 +50,3 @@ jobs: - name: Firestore Rules run: pnpm test:firestore-rules - - - name: Verify release artifact encryption - run: node --test scripts/release-artifact.test.mjs scripts/store-release.test.mjs diff --git a/.github/workflows/release-throwl.yaml b/.github/workflows/release-throwl.yaml index bb47c4de..f110b482 100644 --- a/.github/workflows/release-throwl.yaml +++ b/.github/workflows/release-throwl.yaml @@ -162,10 +162,6 @@ jobs: working-directory: apps/throwl bundler-cache: true - - name: Verify store preparation safeguards - working-directory: apps/throwl - run: bundle exec ruby fastlane/prepare_store_review_test.rb - - name: Prepare App Store Connect draft id: ios continue-on-error: true diff --git a/apps/throwl/fastlane/prepare_store_review.rb b/apps/throwl/fastlane/prepare_store_review.rb index 92f32c8b..503cba87 100644 --- a/apps/throwl/fastlane/prepare_store_review.rb +++ b/apps/throwl/fastlane/prepare_store_review.rb @@ -5,6 +5,13 @@ module StoreReview PLAY_DRAFT_STATE = 'RELEASE_LIFECYCLE_STATE_NOT_SENT_FOR_REVIEW' PLAY_PACKAGE = 'com.throwl' + def self.wait_for_store + 6.times.any? do |attempt| + sleep(5) if attempt.positive? + yield + end + end + def self.prepare_ios(app, api, release) version_name = release.fetch('version') build_number = release.fetch('iosBuild') @@ -57,8 +64,7 @@ def self.prepare_ios(app, api, release) draft.add_app_store_version_to_review_items(app_store_version_id: version.id) end - confirmed = 6.times.any? do |attempt| - sleep(5) if attempt.positive? + confirmed = wait_for_store do selected = app.get_app_store_versions(filter: version_filter, includes: 'build').first selected&.build&.id == build.id && selected.release_type == MANUAL_RELEASE && @@ -116,8 +122,7 @@ def self.prepare_android(service, api, release) end end - saved = 6.times.any? do |attempt| - sleep(5) if attempt.positive? + saved = wait_for_store do Array(service.list_application_track_releases(production).releases).any? do |item| item.release_name == version && item.release_lifecycle_state == PLAY_DRAFT_STATE && diff --git a/apps/throwl/fastlane/prepare_store_review_test.rb b/apps/throwl/fastlane/prepare_store_review_test.rb deleted file mode 100644 index 6f64a3c6..00000000 --- a/apps/throwl/fastlane/prepare_store_review_test.rb +++ /dev/null @@ -1,119 +0,0 @@ -require 'minitest/autorun' -require 'ostruct' -require 'google/apis/androidpublisher_v3' -require_relative 'prepare_store_review' - -class StoreReviewTest < Minitest::Test - Play = Google::Apis::AndroidpublisherV3 - Release = { - 'version' => '5.1.2', - 'iosBuild' => '7', - 'androidBuild' => '45', - 'notes' => { 'en-US' => { 'whatsNew' => 'Team games', 'iosPromotionalText' => 'Play as a team' } } - }.freeze - - class PlayService - attr_reader :commit_options, :production, :edit_deleted - - def initialize(internal_code) - @internal_code = internal_code - end - - def list_application_track_releases(_track) - releases = if commit_options - [OpenStruct.new( - release_name: '5.1.2', release_lifecycle_state: StoreReview::PLAY_DRAFT_STATE, - active_artifacts: [OpenStruct.new(version_code: 45)] - )] - else - [] - end - OpenStruct.new(releases: releases) - end - - def insert_edit(_package) - OpenStruct.new(id: 'test-edit') - end - - def get_edit_track(_package, _edit, track) - Play::Track.new(releases: [Play::TrackRelease.new( - status: 'completed', version_codes: [track == 'internal' ? @internal_code : 44] - )]) - end - - def update_edit_track(_package, _edit, _track, production) - @production = production - end - - def validate_edit(_package, _edit); end - - def commit_edit(_package, _edit, **options) - @commit_options = options - end - - def delete_edit(_package, _edit) - @edit_deleted = true - end - end - - def test_play_prepares_exact_internal_bundle_and_does_not_send_it_for_review - service = PlayService.new(45) - StoreReview.prepare_android(service, Play, Release) - - candidate = service.production.releases.fetch(0) - assert_equal [45], candidate.version_codes - assert_equal 'Team games', candidate.release_notes.fetch(0).text - assert_equal({ - changes_not_sent_for_review: true, - changes_in_review_behavior: 'ERROR_IF_IN_REVIEW' - }, service.commit_options) - end - - def test_play_leaves_production_alone_when_the_requested_internal_bundle_is_missing - service = PlayService.new(46) - assert_raises(RuntimeError, /no longer on Play Internal/) do - StoreReview.prepare_android(service, Play, Release) - end - assert_nil service.production - assert_nil service.commit_options - assert service.edit_deleted - end - - def test_apple_attaches_the_tested_build_and_prepares_a_draft_without_submitting - build = OpenStruct.new(id: 'beta-build', processing_state: 'VALID', expired: false) - builder = Object.new - builder.define_singleton_method(:all) do |**options| - raise 'Wrong iOS build lookup' unless options == { app_id: 'app', version: '5.1.2', build_number: '7', platform: 'IOS' } - - [build] - end - api = Module.new - api.const_set(:Build, builder) - localization = OpenStruct.new(locale: 'en-US') - localization.define_singleton_method(:update) do |attributes:| - self.whats_new = attributes.fetch(:whatsNew) - self.promotional_text = attributes.fetch(:promotionalText) - end - version = OpenStruct.new(id: 'version', app_version_state: 'PREPARE_FOR_SUBMISSION') - version.define_singleton_method(:select_build) { |build_id:| self.build = build if build.id == build_id } - version.define_singleton_method(:update) { |attributes:| self.release_type = attributes.fetch(:releaseType) } - version.define_singleton_method(:get_app_store_version_localizations) { [localization] } - - draft = Object.new - draft.define_singleton_method(:add_app_store_version_to_review_items) do |app_store_version_id:| - version.app_version_state = 'READY_FOR_REVIEW' if app_store_version_id == version.id - end - app = OpenStruct.new(id: 'app') - app.define_singleton_method(:get_app_store_versions) { |**| [version] } - app.define_singleton_method(:get_review_submissions) { |**| [] } - app.define_singleton_method(:create_review_submission) { |platform:| draft if platform == 'IOS' } - - StoreReview.prepare_ios(app, api, Release) - - assert_equal 'beta-build', version.build.id - assert_equal 'MANUAL', version.release_type - assert_equal 'Team games', localization.whats_new - assert_equal 'Play as a team', localization.promotional_text - assert_equal 'READY_FOR_REVIEW', version.app_version_state - end -end diff --git a/package.json b/package.json index 3e6c7d30..8afc9a33 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "test:firestore-rules": "firebase emulators:exec --project demo-throwl-rules --only firestore \"node --test firebase/firestore.rules.test.mjs\"", "test:affected": "nx affected --target=test --parallel --maxParallel=5", "postinstall": "husky", - "test:firestore-clone": "node --test scripts/clone-firestore-data.test.mjs", "clone:firestore": "node scripts/clone-firestore-data.mjs" }, "packageManager": "pnpm@10.24.0", diff --git a/scripts/clone-firestore-data.test.mjs b/scripts/clone-firestore-data.test.mjs deleted file mode 100644 index 77199dd5..00000000 --- a/scripts/clone-firestore-data.test.mjs +++ /dev/null @@ -1,57 +0,0 @@ -import assert from 'node:assert/strict'; -import { after, describe, test } from 'node:test'; -import { initializeApp, deleteApp } from 'firebase-admin/app'; -import { GeoPoint, Timestamp, getFirestore } from 'firebase-admin/firestore'; -import { remapFirestoreValue } from './clone-firestore-data.mjs'; - -const sourceApp = initializeApp( - { projectId: 'darts-counter-b73d6' }, - 'clone-test-source', -); -const targetApp = initializeApp( - { projectId: 'throwl-dev' }, - 'clone-test-target', -); -const sourceDb = getFirestore(sourceApp); -const targetDb = getFirestore(targetApp); - -after(async () => { - await Promise.all([deleteApp(sourceApp), deleteApp(targetApp)]); -}); - -describe('Firestore clone value transformation', () => { - test('recursively remaps references and preserves native values', () => { - const timestamp = Timestamp.fromMillis(1_700_000_000_123); - const geoPoint = new GeoPoint(52.37, 4.9); - const bytes = Buffer.from([1, 2, 3]); - const inventory = { - referenceCount: 0, - referenceDocumentPaths: new Set(), - referenceProjects: new Set(), - nativeTypes: new Set(), - unsupportedTypes: new Set(), - }; - const transformed = remapFirestoreValue( - { - nested: [ - sourceDb.doc('users/ABC'), - { timestamp, geoPoint, bytes, nil: null, enabled: true }, - ], - }, - targetDb, - inventory, - 'games/game-1', - ); - - assert.equal(transformed.nested[0].path, 'users/ABC'); - assert.equal(transformed.nested[0].firestore.projectId, 'throwl-dev'); - assert.equal(transformed.nested[1].timestamp, timestamp); - assert.equal(transformed.nested[1].geoPoint, geoPoint); - assert.notEqual(transformed.nested[1].bytes, bytes); - assert.deepEqual(transformed.nested[1].bytes, bytes); - assert.equal(inventory.referenceCount, 1); - assert.deepEqual([...inventory.referenceProjects], ['darts-counter-b73d6']); - assert.deepEqual([...inventory.referenceDocumentPaths], ['games/game-1']); - assert.equal(inventory.unsupportedTypes.size, 0); - }); -}); diff --git a/scripts/release-artifact.test.mjs b/scripts/release-artifact.test.mjs deleted file mode 100644 index 94965bc5..00000000 --- a/scripts/release-artifact.test.mjs +++ /dev/null @@ -1,52 +0,0 @@ -import assert from 'node:assert/strict'; -import { spawnSync } from 'node:child_process'; -import { randomBytes } from 'node:crypto'; -import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; -import { tmpdir } from 'node:os'; -import { join } from 'node:path'; -import { test } from 'node:test'; -import { fileURLToPath } from 'node:url'; - -const script = fileURLToPath( - new URL('./release-artifact.mjs', import.meta.url), -); - -test('the upload job recovers the exact signed bundle and rejects altered handoffs', async (t) => { - const directory = await mkdtemp(join(tmpdir(), 'throwl-release-test-')); - t.after(() => rm(directory, { recursive: true, force: true })); - - const original = join(directory, 'original.ipa'); - const encrypted = join(directory, 'release-bundle.enc'); - const recovered = join(directory, 'recovered.ipa'); - const rejected = join(directory, 'rejected.ipa'); - const bytes = randomBytes(8192); - await writeFile(original, bytes); - - const key = randomBytes(32).toString('hex'); - const context = 'release-run:release-commit:apps/throwl/ios'; - const run = (args, secret = key, release = context) => - spawnSync(process.execPath, [script, ...args], { - env: { RELEASE_ARTIFACT_KEY: secret, RELEASE_ARTIFACT_CONTEXT: release }, - encoding: 'utf8', - }); - - assert.notEqual(run(['check'], '').status, 0); - - const encryption = run(['encrypt', original, encrypted]); - assert.equal(encryption.status, 0, encryption.stderr); - assert.notDeepEqual(await readFile(encrypted), bytes); - - const decryption = run(['decrypt', encrypted, recovered]); - assert.equal(decryption.status, 0, decryption.stderr); - assert.deepEqual(await readFile(recovered), bytes); - - const decrypt = ['decrypt', encrypted, rejected]; - assert.notEqual(run(decrypt, randomBytes(32).toString('hex')).status, 0); - assert.notEqual(run(decrypt, key, 'different-release').status, 0); - - const tampered = await readFile(encrypted); - tampered[tampered.length - 1] ^= 1; - await writeFile(encrypted, tampered); - assert.notEqual(run(decrypt).status, 0); - await assert.rejects(readFile(rejected), { code: 'ENOENT' }); -}); diff --git a/scripts/store-release.mjs b/scripts/store-release.mjs index 49e95a1a..c3c0d23e 100644 --- a/scripts/store-release.mjs +++ b/scripts/store-release.mjs @@ -1,140 +1,120 @@ import { readFile, writeFile } from 'node:fs/promises'; -import { pathToFileURL } from 'node:url'; -const ready = - '\n**Both stores are ready to submit.** Open App Store Connect and Play Console to send each release for review.'; +const [command, source, output, currentDraft] = process.argv.slice(2); +const readJson = async (path) => JSON.parse(await readFile(path, 'utf8')); +const snapshot = await readJson(source); -function singleMatch(text, pattern, message) { - const matches = [...text.matchAll(pattern)]; - if (matches.length !== 1) throw new Error(message); - return matches[0][1]; -} - -export function readStoreNotes(body) { - const json = singleMatch( - body, - /\s*```json\r?\n([\s\S]*?)\r?\n```/g, - 'Keep exactly one store-notes JSON block in the GitHub draft.', - ); - const notes = JSON.parse(json); - if (!notes?.['en-US'] || Array.isArray(notes)) { - throw new Error('Store notes must include en-US.'); - } +function storeNotes(body) { + const blocks = [ + ...body.matchAll( + /\s*```json\r?\n([\s\S]*?)\r?\n```/g, + ), + ]; + if (blocks.length !== 1) + throw new Error('Keep one store-notes JSON block in the GitHub draft.'); + const notes = JSON.parse(blocks[0][1]); + if (!notes?.['en-US']) throw new Error('Store notes must include en-US.'); for (const [locale, entry] of Object.entries(notes)) { + const { whatsNew, iosPromotionalText } = entry ?? {}; if ( !/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(locale) || - !entry || - typeof entry !== 'object' + typeof whatsNew !== 'string' || + !whatsNew.trim() || + [...whatsNew].length > 500 ) { - throw new Error(`Invalid store locale or entry: ${locale}`); - } - const text = entry.whatsNew; - if (typeof text !== 'string' || !text.trim() || [...text].length > 500) { - throw new Error(`${locale} What’s New must contain 1–500 characters.`); + throw new Error( + `Invalid locale or What’s New text for ${locale} (maximum 500 characters).`, + ); } if ( - entry.iosPromotionalText !== undefined && - (typeof entry.iosPromotionalText !== 'string' || - [...entry.iosPromotionalText].length > 170) + iosPromotionalText !== undefined && + (typeof iosPromotionalText !== 'string' || + [...iosPromotionalText].length > 170) ) { throw new Error( - `${locale} iOS promotional text must be at most 170 characters.`, + `${locale} iOS promotional text must contain at most 170 characters.`, ); } } return notes; } -export function readReleaseIdentity(tag, appVersion, gradle, xcode) { - if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag !== `v${appVersion}`) { - throw new Error('The release tag and app package version must match.'); +function nativeValue(file, pattern, field) { + const values = new Set([...file.matchAll(pattern)].map((match) => match[1])); + if (values.size !== 1) + throw new Error( + `Expected one value for ${field} in the tagged build settings.`, + ); + return values.values().next().value; +} + +let result; +if (command === 'snapshot') { + const { version } = await readJson('apps/throwl/package.json'); + if ( + !snapshot.draft || + snapshot.tag_name !== process.env.RELEASE_TAG || + snapshot.tag_name !== `v${version}` + ) { + throw new Error( + 'Expected the GitHub draft matching the tagged app version.', + ); } - const androidBuild = singleMatch( - gradle, - /^\s*versionCode\s+(\d+)\s*$/gm, - 'Expected one Android version code.', + + const gradle = await readFile('apps/throwl/android/app/build.gradle', 'utf8'); + const xcode = await readFile( + 'apps/throwl/ios/Throwl.xcodeproj/project.pbxproj', + 'utf8', ); - const androidVersion = singleMatch( + const androidVersion = nativeValue( gradle, /^\s*versionName\s+"([^"]+)"\s*$/gm, - 'Expected one Android version name.', + 'Android version', + ); + const iosVersion = nativeValue( + xcode, + /^\s*MARKETING_VERSION\s*=\s*([\d.]+);\s*$/gm, + 'iOS version', ); - const iosBuilds = [ - ...new Set( - [...xcode.matchAll(/^\s*CURRENT_PROJECT_VERSION\s*=\s*(\d+);\s*$/gm)].map( - (match) => match[1], - ), + if (androidVersion !== version || iosVersion !== version) + throw new Error('Native versions must match the tag.'); + + result = { + id: snapshot.id, + body: snapshot.body, + version, + androidBuild: nativeValue( + gradle, + /^\s*versionCode\s+(\d+)\s*$/gm, + 'Android build', ), - ]; - if (iosBuilds.length !== 1) throw new Error('iOS build numbers must agree.'); - const iosVersions = [ - ...new Set( - [...xcode.matchAll(/^\s*MARKETING_VERSION\s*=\s*([\d.]+);\s*$/gm)].map( - (match) => match[1], - ), + iosBuild: nativeValue( + xcode, + /^\s*CURRENT_PROJECT_VERSION\s*=\s*(\d+);\s*$/gm, + 'iOS build', ), - ]; + notes: storeNotes(snapshot.body), + }; +} else if (command === 'ready') { + const draft = await readJson(currentDraft); if ( - androidVersion !== appVersion || - iosVersions.length !== 1 || - iosVersions[0] !== appVersion + !draft.draft || + draft.id !== snapshot.id || + draft.body !== snapshot.body ) { throw new Error( - 'The native marketing versions must match the tagged app version.', + 'The GitHub draft changed during preparation. Rerun with the current notes.', ); } - return { version: appVersion, androidBuild, iosBuild: iosBuilds[0] }; -} - -export function markReady(body) { - const notes = body.replace( + const body = draft.body.replace( /^\s*(?:\*\*(?:Production review drafts have not been prepared|Both stores are ready to submit)\.\*\*[^\r\n]*\s*)?/, '', ); - return `${ready}\n\n${notes}`; -} - -if ( - process.argv[1] && - import.meta.url === pathToFileURL(process.argv[1]).href -) { - const [command, source, output] = process.argv.slice(2); - if (command === 'snapshot') { - const release = JSON.parse(await readFile(source, 'utf8')); - if (!release.draft || release.tag_name !== process.env.RELEASE_TAG) { - throw new Error( - 'Expected the GitHub draft for the selected release tag.', - ); - } - const identity = readReleaseIdentity( - release.tag_name, - JSON.parse(await readFile('apps/throwl/package.json', 'utf8')).version, - await readFile('apps/throwl/android/app/build.gradle', 'utf8'), - await readFile( - 'apps/throwl/ios/Throwl.xcodeproj/project.pbxproj', - 'utf8', - ), - ); - await writeFile( - output, - JSON.stringify({ - ...identity, - id: release.id, - body: release.body, - notes: readStoreNotes(release.body), - }), - ); - } else if (command === 'ready') { - const snapshot = JSON.parse(await readFile(source, 'utf8')); - const current = JSON.parse(await readFile(process.argv[5], 'utf8')); - if (!current.draft || current.body !== snapshot.body) { - throw new Error( - 'The GitHub draft changed during preparation. Rerun with the current notes.', - ); - } - await writeFile(output, JSON.stringify({ body: markReady(snapshot.body) })); - } else { - throw new Error('Expected snapshot or ready.'); - } + result = { + body: `\n**Both stores are ready to submit.** Open App Store Connect and Play Console to send each release for review.\n\n${body}`, + }; +} else { + throw new Error('Expected snapshot or ready.'); } +await writeFile(output, JSON.stringify(result)); diff --git a/scripts/store-release.test.mjs b/scripts/store-release.test.mjs deleted file mode 100644 index b955a523..00000000 --- a/scripts/store-release.test.mjs +++ /dev/null @@ -1,68 +0,0 @@ -import assert from 'node:assert/strict'; -import { test } from 'node:test'; -import { readFile } from 'node:fs/promises'; -import { - markReady, - readReleaseIdentity, - readStoreNotes, -} from './store-release.mjs'; - -test('store notes come from the dedicated block and the GitHub changelog stays intact', async () => { - const template = await readFile( - new URL('../apps/throwl/fastlane/store-release-notes.md', import.meta.url), - 'utf8', - ); - const original = template.replace( - '## Changes', - '## Changes\nUpdated the scoreboard.', - ); - assert.throws(() => readStoreNotes(original), /What’s New/); - const edited = original.replace('"whatsNew": ""', '"whatsNew": "Team games"'); - assert.deepEqual(readStoreNotes(edited), { - 'en-US': { whatsNew: 'Team games', iosPromotionalText: '' }, - }); - assert.throws( - () => readStoreNotes(edited.replace('Team games', '🎯'.repeat(501))), - /500 characters/, - ); - assert.throws( - () => - readStoreNotes( - edited.replace( - '"iosPromotionalText": ""', - `"iosPromotionalText": "${'a'.repeat(171)}"`, - ), - ), - /170 characters/, - ); - const ready = markReady(edited); - assert.match(ready, /Both stores are ready/); - assert.doesNotMatch(ready, /Production review drafts have not been prepared/); - assert.match(ready, /Updated the scoreboard/); - assert.deepEqual(readStoreNotes(ready), readStoreNotes(edited)); - assert.equal(markReady(ready), ready); -}); - -test('the expected release identity uses platform build numbers from the tag', () => { - const gradle = 'versionCode 45\nversionName "5.1.2"'; - const xcode = 'CURRENT_PROJECT_VERSION = 7;\nMARKETING_VERSION = 5.1.2;'; - assert.deepEqual(readReleaseIdentity('v5.1.2', '5.1.2', gradle, xcode), { - version: '5.1.2', - androidBuild: '45', - iosBuild: '7', - }); - assert.throws( - () => readReleaseIdentity('v5.1.3', '5.1.2', gradle, xcode), - /must match/, - ); - assert.throws( - () => - readReleaseIdentity( - 'v5.1.2', - '5.1.2', - gradle, - xcode.replace('5.1.2', '5.1.1'), - ), - /marketing versions/, - ); -}); From d5d8ddd35d70d74ff93444c82bcce6c8683142af Mon Sep 17 00:00:00 2001 From: Bart de Lange Date: Fri, 27 Nov 2026 16:12:13 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=A7=B9=20chore(config):=20Use=20Fastl?= =?UTF-8?q?ane=20for=20approved=20store=20releases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-throwl.yaml | 51 +++++- CONTRIBUTING.md | 21 ++- apps/throwl/fastlane/Fastfile | 55 +++++++ apps/throwl/fastlane/prepare_store_review.rb | 165 ------------------- scripts/store-release.mjs | 120 -------------- 5 files changed, 110 insertions(+), 302 deletions(-) delete mode 100644 apps/throwl/fastlane/prepare_store_review.rb delete mode 100644 scripts/store-release.mjs diff --git a/.github/workflows/release-throwl.yaml b/.github/workflows/release-throwl.yaml index f110b482..c2024ba9 100644 --- a/.github/workflows/release-throwl.yaml +++ b/.github/workflows/release-throwl.yaml @@ -116,13 +116,13 @@ jobs: IOS_GOOGLE_SERVICE_INFO_PLIST_B64: ${{ secrets.IOS_GOOGLE_SERVICE_INFO_PLIST_B64 }} prepare: - name: Prepare iOS and Android for manual review submission + name: Submit iOS for review and prepare Google Play production needs: [deploy_android, deploy_ios] if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && !github.event.repository.fork concurrency: group: throwl-production-store-preparation cancel-in-progress: false - runs-on: ubuntu-24.04 + runs-on: macos-latest environment: store-review permissions: actions: read @@ -153,8 +153,33 @@ jobs: gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/releases" \ | jq -e '[.[][] | select(.tag_name == env.RELEASE_TAG and .draft)] | if length == 1 then .[0] else error("Expected one GitHub draft for this tag") end' \ > "$RUNNER_TEMP/draft.json" - node scripts/store-release.mjs snapshot "$RUNNER_TEMP/draft.json" "$RUNNER_TEMP/store-release.json" - echo "id=$(jq -er .id "$RUNNER_TEMP/store-release.json")" >> "$GITHUB_OUTPUT" + jq -er '[ + .body | match("\\s*```json\\r?\\n([\\s\\S]*?)\\r?\\n```"; "g") | .captures[0].string + ] | if length == 1 then .[0] | fromjson else error("Keep one store-notes JSON block in the draft") end + | if .["en-US"] and all(to_entries[]; + (.key | test("^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$")) and + (.value.whatsNew | type == "string" and test("\\S") and length <= 500) and + (.value | if has("iosPromotionalText") then + .iosPromotionalText | type == "string" and length <= 170 + else true end)) + then . else error("Fill in the store notes and check the locale and text lengths") end' \ + "$RUNNER_TEMP/draft.json" > "$RUNNER_TEMP/store-notes.json" + + version=$(jq -er .version apps/throwl/package.json) + gradle=apps/throwl/android/app/build.gradle + xcode=apps/throwl/ios/Throwl.xcodeproj/project.pbxproj + android_build=$(awk '$1 == "versionCode" { print $2 }' "$gradle") + ios_build=$(awk '$1 == "CURRENT_PROJECT_VERSION" { gsub(/;/, "", $3); print $3 }' "$xcode" | sort -u) + android_version=$(awk '$1 == "versionName" { gsub(/"/, "", $2); print $2 }' "$gradle") + ios_version=$(awk '$1 == "MARKETING_VERSION" { gsub(/;/, "", $3); print $3 }' "$xcode" | sort -u) + [[ "$RELEASE_TAG" == "v$version" && "$android_version" == "$version" && "$ios_version" == "$version" ]] + [[ "$android_build" =~ ^[0-9]+$ && "$ios_build" =~ ^[0-9]+$ ]] + { + echo "id=$(jq -er .id "$RUNNER_TEMP/draft.json")" + echo "version=$version" + echo "ios_build=$ios_build" + echo "android_build=$android_build" + } >> "$GITHUB_OUTPUT" - name: Set up Ruby uses: ruby/setup-ruby@145243922b4465b78e04dd66294782c7de45901f # v1.345.0 @@ -162,12 +187,14 @@ jobs: working-directory: apps/throwl bundler-cache: true - - name: Prepare App Store Connect draft + - name: Submit tested iOS build to App Review id: ios continue-on-error: true working-directory: apps/throwl - run: bundle exec ruby fastlane/prepare_store_review.rb ios "$RUNNER_TEMP/store-release.json" + run: bundle exec fastlane ios submit_tested_build "version:$VERSION" "build:$BUILD_NUMBER" "notes:$RUNNER_TEMP/store-notes.json" env: + VERSION: ${{ steps.release.outputs.version }} + BUILD_NUMBER: ${{ steps.release.outputs.ios_build }} DEVELOPER_APP_IDENTIFIER: ${{ secrets.DEVELOPER_APP_IDENTIFIER }} APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} @@ -177,11 +204,12 @@ jobs: id: android continue-on-error: true working-directory: apps/throwl - run: bundle exec ruby fastlane/prepare_store_review.rb android "$RUNNER_TEMP/store-release.json" + run: bundle exec fastlane android prepare_tested_build "build:$BUILD_NUMBER" "notes:$RUNNER_TEMP/store-notes.json" env: + BUILD_NUMBER: ${{ steps.release.outputs.android_build }} PLAY_CONFIG_JSON: ${{ secrets.PLAY_CONFIG_JSON }} - - name: Mark the GitHub draft ready when both stores confirm + - name: Record both store results in the GitHub draft env: GH_TOKEN: ${{ github.token }} RELEASE_ID: ${{ steps.release.outputs.id }} @@ -191,6 +219,11 @@ jobs: printf '### Store preparation\n\n- iOS: %s\n- Android: %s\n' "$IOS_OUTCOME" "$ANDROID_OUTCOME" >> "$GITHUB_STEP_SUMMARY" [[ "$IOS_OUTCOME" == success && "$ANDROID_OUTCOME" == success ]] || exit 1 gh api "repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" > "$RUNNER_TEMP/current-draft.json" - node scripts/store-release.mjs ready "$RUNNER_TEMP/store-release.json" "$RUNNER_TEMP/ready.json" "$RUNNER_TEMP/current-draft.json" + jq -e --slurpfile original "$RUNNER_TEMP/draft.json" ' + if .draft and .body == $original[0].body then + {body: ("\n**iOS submitted for App Review. Android prepared for manual submission in Play Console.**\n\n" + + (.body | sub("^\\s*\\*\\*[^\\r\\n]*\\s*"; "")))} + else error("The GitHub draft changed during store preparation; update its status manually") end + ' "$RUNNER_TEMP/current-draft.json" > "$RUNNER_TEMP/ready.json" gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" \ --input "$RUNNER_TEMP/ready.json" --jq .html_url diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22edbaf2..050d4f3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,13 +135,18 @@ Internal builds before approving `store-review` in that run. Before the first release, configure the `store-review` GitHub environment with required reviewers, allow version tags, and allow self-review if you cut and approve releases yourself. The job checks the run's approval history before -writing to either store. The App Store Connect key needs permission to manage versions and review -drafts, and the Play service account needs permission to edit production +writing to either store. The App Store Connect key needs permission to submit +versions for review, and the Play service account needs permission to edit production releases. The workflow reuses the existing Actions credentials. -The workflow reports each store separately and marks the GitHub draft ready -only after both stores confirm the exact builds are prepared. Submit for -review manually in each store. The workflow leaves the GitHub release in -draft so a maintainer can publish it at the appropriate time. Apple manual -release after approval is set on the prepared version. Use Play managed -publishing if Play should also wait for a manual rollout after review. +Approving the job submits the tested iOS build to App Review and sets manual +App Store release after approval. On Google Play it promotes the tested build +to production with changes left unsent. Before approving, check that Play has +no active production review or rollout. Fastlane's promotion uses Google's +default handling for an existing review. In Play Console, send the changes +for review manually. Use managed publishing if Play should wait for a manual +rollout after review. + +After both lanes succeed, the workflow records their outcomes on the GitHub +draft. Publish that draft separately. If one lane fails, check both store +consoles before retrying because the other lane may have already succeeded. diff --git a/apps/throwl/fastlane/Fastfile b/apps/throwl/fastlane/Fastfile index 2c471b8c..b09ff3be 100644 --- a/apps/throwl/fastlane/Fastfile +++ b/apps/throwl/fastlane/Fastfile @@ -1,3 +1,8 @@ +require "base64" +require "json" +require "tmpdir" +require "fileutils" + default_platform(:ios) DEVELOPER_APP_IDENTIFIER = ENV.fetch("DEVELOPER_APP_IDENTIFIER", nil) @@ -66,6 +71,26 @@ platform :ios do notify_external_testers: false ) end + + desc "Submit the approved TestFlight build for App Review with manual release" + lane :submit_tested_build do |options| + notes = JSON.parse(File.read(options.fetch(:notes))) + deliver( + api_key: testflight_api_key, + app_identifier: DEVELOPER_APP_IDENTIFIER, + app_version: options.fetch(:version).to_s, + build_number: options.fetch(:build).to_s, + release_notes: notes.transform_values { |entry| entry.fetch("whatsNew") }, + promotional_text: notes.filter { |_, entry| entry.key?("iosPromotionalText") } + .transform_values { |entry| entry.fetch("iosPromotionalText") }, + skip_binary_upload: true, + skip_screenshots: true, + force: true, + run_precheck_before_submit: false, + automatic_release: false, + submit_for_review: true + ) + end end platform :android do @@ -104,4 +129,34 @@ platform :android do track: "internal" ) end + + desc "Promote the approved Play Internal build to production without sending it for review" + lane :prepare_tested_build do |options| + code = Integer(options.fetch(:build)) + Dir.mktmpdir("throwl-play-release") do |temporary| + metadata = File.join(temporary, "metadata") + credentials = File.join(temporary, "credentials.json") + File.write(credentials, Base64.strict_decode64(ENV.fetch("PLAY_CONFIG_JSON")), perm: 0o600) + JSON.parse(File.read(options.fetch(:notes))).each do |locale, entry| + directory = File.join(metadata, locale, "changelogs") + FileUtils.mkdir_p(directory) + File.write(File.join(directory, "#{code}.txt"), entry.fetch("whatsNew")) + end + + upload_to_play_store( + json_key: credentials, + track: "internal", + track_promote_to: "production", + version_code: code, + metadata_path: metadata, + skip_upload_apk: true, + skip_upload_aab: true, + skip_upload_metadata: true, + skip_upload_images: true, + skip_upload_screenshots: true, + changes_not_sent_for_review: true, + rescue_changes_not_sent_for_review: false + ) + end + end end diff --git a/apps/throwl/fastlane/prepare_store_review.rb b/apps/throwl/fastlane/prepare_store_review.rb deleted file mode 100644 index 503cba87..00000000 --- a/apps/throwl/fastlane/prepare_store_review.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'json' - -module StoreReview - MANUAL_RELEASE = 'MANUAL' - PLAY_DRAFT_STATE = 'RELEASE_LIFECYCLE_STATE_NOT_SENT_FOR_REVIEW' - PLAY_PACKAGE = 'com.throwl' - - def self.wait_for_store - 6.times.any? do |attempt| - sleep(5) if attempt.positive? - yield - end - end - - def self.prepare_ios(app, api, release) - version_name = release.fetch('version') - build_number = release.fetch('iosBuild') - builds = api::Build.all(app_id: app.id, version: version_name, build_number: build_number, platform: 'IOS') - build = builds.find { |candidate| candidate.processing_state == 'VALID' && !candidate.expired } - raise "iOS #{version_name} build #{build_number} is unavailable or still processing. Check App Store Connect and retry." unless build - - version_filter = { platform: 'IOS', versionString: version_name } - version = app.get_app_store_versions(filter: version_filter, includes: 'build').first - unless version - api.post_app_store_version(app_id: app.id, attributes: { platform: 'IOS', versionString: version_name, releaseType: MANUAL_RELEASE }) - version = app.get_app_store_versions(filter: version_filter, includes: 'build').first - end - raise "Could not read App Store version #{version_name}." unless version - - state = version.app_version_state || version.app_store_state - unless %w[PREPARE_FOR_SUBMISSION READY_FOR_REVIEW].include?(state) - raise "App Store version #{version_name} is #{state}. Resolve its existing review state before retrying." - end - if state == 'READY_FOR_REVIEW' && version.build&.id != build.id - raise 'A different iOS build is already attached to the draft review submission.' - end - version.select_build(build_id: build.id) if version.build&.id != build.id - version.update(attributes: { releaseType: MANUAL_RELEASE }) if version.release_type != MANUAL_RELEASE - - localizations = version.get_app_store_version_localizations - release.fetch('notes').each do |locale, notes| - localization = localizations.find { |item| item.locale == locale } - raise "Configure the #{locale} locale in App Store Connect before retrying." unless localization - - attributes = { whatsNew: notes.fetch('whatsNew') } - attributes[:promotionalText] = notes['iosPromotionalText'] if notes.key?('iosPromotionalText') - if localization.whats_new != attributes[:whatsNew] || - (attributes.key?(:promotionalText) && localization.promotional_text.to_s != attributes[:promotionalText]) - localization.update(attributes: attributes) - end - end - - filter = { platform: 'IOS', state: 'READY_FOR_REVIEW' } - drafts = app.get_review_submissions(filter: filter, includes: 'appStoreVersionForReview,items') - draft = drafts.find do |item| - item.app_store_version_for_review&.id == version.id || - Array(item.items).any? { |entry| entry.app_store_version&.id == version.id } - end - unless draft - # An earlier attempt can leave an empty draft before the version was attached. - raise 'Another iOS review draft exists. Review it in App Store Connect before retrying.' if drafts.any? { |item| item.app_store_version_for_review || !Array(item.items).empty? } - - draft = drafts.first || app.create_review_submission(platform: 'IOS') - draft.add_app_store_version_to_review_items(app_store_version_id: version.id) - end - - confirmed = wait_for_store do - selected = app.get_app_store_versions(filter: version_filter, includes: 'build').first - selected&.build&.id == build.id && - selected.release_type == MANUAL_RELEASE && - (selected.app_version_state || selected.app_store_state) == 'READY_FOR_REVIEW' - end - unless confirmed - raise 'App Store Connect has not confirmed the expected build in a manual review draft. Check the console and retry.' - end - puts "iOS #{version_name} (#{build_number}) is ready for manual submission." - end - - def self.prepare_android(service, api, release) - code = Integer(release.fetch('androidBuild'), 10) - version = release.fetch('version') - production = "applications/#{PLAY_PACKAGE}/tracks/production" - existing = service.list_application_track_releases(production).releases || [] - target = existing.find { |item| Array(item.active_artifacts).any? { |artifact| artifact.version_code.to_i == code } } - if target && target.release_lifecycle_state != PLAY_DRAFT_STATE - raise "Android build #{code} already has a production release in state #{target.release_lifecycle_state}." - end - if existing.any? { |item| item != target && item.release_lifecycle_state != 'RELEASE_LIFECYCLE_STATE_PUBLISHED' } - raise 'Another Google Play production release is pending. Resolve it in Play Console before retrying.' - end - - edit = service.insert_edit(PLAY_PACKAGE) - committed = false - begin - internal = service.get_edit_track(PLAY_PACKAGE, edit.id, 'internal') - unless Array(internal.releases).any? { |item| Array(item.version_codes).map(&:to_i).include?(code) } - raise "Android build #{code} is no longer on Play Internal. Verify the candidate before preparing production." - end - - track = service.get_edit_track(PLAY_PACKAGE, edit.id, 'production') - releases = Array(track.releases) - if releases.any? { |item| %w[inProgress halted].include?(item.status) || Array(item.version_codes).any? { |value| value.to_i > code } } - raise 'A staged, halted or newer Google Play release exists. Resolve it before preparing this candidate.' - end - - notes = release.fetch('notes').map do |locale, entry| - api::LocalizedText.new(language: locale, text: entry.fetch('whatsNew')) - end - target_release = api::TrackRelease.new(name: version, version_codes: [code], release_notes: notes, status: 'completed') - service.update_edit_track(PLAY_PACKAGE, edit.id, 'production', api::Track.new(track: 'production', releases: [target_release])) - service.validate_edit(PLAY_PACKAGE, edit.id) - # Never fall back to Fastlane's automatic commit retry or omit either guard. - service.commit_edit(PLAY_PACKAGE, edit.id, changes_not_sent_for_review: true, changes_in_review_behavior: 'ERROR_IF_IN_REVIEW') - committed = true - ensure - unless committed - begin - service.delete_edit(PLAY_PACKAGE, edit.id) - rescue Google::Apis::Error - # Expired or concurrently invalidated edits need no further cleanup. - end - end - end - - saved = wait_for_store do - Array(service.list_application_track_releases(production).releases).any? do |item| - item.release_name == version && - item.release_lifecycle_state == PLAY_DRAFT_STATE && - Array(item.active_artifacts).map { |artifact| artifact.version_code.to_i } == [code] - end - end - raise "Play Console has not confirmed Android build #{code} is waiting for manual review submission. Check Publishing overview." unless saved - - puts "Android #{version} (#{code}) is ready for manual submission." - end -end - -if $PROGRAM_NAME == __FILE__ - platform, path = ARGV - release = JSON.parse(File.read(path)) - case platform - when 'ios' - require 'spaceship' - api = Spaceship::ConnectAPI - api.token = api::Token.create(key_id: ENV.fetch('APPLE_KEY_ID'), issuer_id: ENV.fetch('APPLE_ISSUER_ID'), key: ENV.fetch('APPLE_KEY_CONTENT')) - app = api::App.find(ENV.fetch('DEVELOPER_APP_IDENTIFIER')) - raise 'App Store Connect app was not found.' unless app - - StoreReview.prepare_ios(app, api, release) - when 'android' - require 'base64' - require 'google/apis/androidpublisher_v3' - require 'googleauth' - require 'stringio' - api = Google::Apis::AndroidpublisherV3 - service = api::AndroidPublisherService.new - service.authorization = Google::Auth::ServiceAccountCredentials.make_creds( - json_key_io: StringIO.new(Base64.strict_decode64(ENV.fetch('PLAY_CONFIG_JSON'))), - scope: api::AUTH_ANDROIDPUBLISHER - ) - StoreReview.prepare_android(service, api, release) - else - raise 'Expected ios or android.' - end -end diff --git a/scripts/store-release.mjs b/scripts/store-release.mjs deleted file mode 100644 index c3c0d23e..00000000 --- a/scripts/store-release.mjs +++ /dev/null @@ -1,120 +0,0 @@ -import { readFile, writeFile } from 'node:fs/promises'; - -const [command, source, output, currentDraft] = process.argv.slice(2); -const readJson = async (path) => JSON.parse(await readFile(path, 'utf8')); -const snapshot = await readJson(source); - -function storeNotes(body) { - const blocks = [ - ...body.matchAll( - /\s*```json\r?\n([\s\S]*?)\r?\n```/g, - ), - ]; - if (blocks.length !== 1) - throw new Error('Keep one store-notes JSON block in the GitHub draft.'); - - const notes = JSON.parse(blocks[0][1]); - if (!notes?.['en-US']) throw new Error('Store notes must include en-US.'); - for (const [locale, entry] of Object.entries(notes)) { - const { whatsNew, iosPromotionalText } = entry ?? {}; - if ( - !/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(locale) || - typeof whatsNew !== 'string' || - !whatsNew.trim() || - [...whatsNew].length > 500 - ) { - throw new Error( - `Invalid locale or What’s New text for ${locale} (maximum 500 characters).`, - ); - } - if ( - iosPromotionalText !== undefined && - (typeof iosPromotionalText !== 'string' || - [...iosPromotionalText].length > 170) - ) { - throw new Error( - `${locale} iOS promotional text must contain at most 170 characters.`, - ); - } - } - return notes; -} - -function nativeValue(file, pattern, field) { - const values = new Set([...file.matchAll(pattern)].map((match) => match[1])); - if (values.size !== 1) - throw new Error( - `Expected one value for ${field} in the tagged build settings.`, - ); - return values.values().next().value; -} - -let result; -if (command === 'snapshot') { - const { version } = await readJson('apps/throwl/package.json'); - if ( - !snapshot.draft || - snapshot.tag_name !== process.env.RELEASE_TAG || - snapshot.tag_name !== `v${version}` - ) { - throw new Error( - 'Expected the GitHub draft matching the tagged app version.', - ); - } - - const gradle = await readFile('apps/throwl/android/app/build.gradle', 'utf8'); - const xcode = await readFile( - 'apps/throwl/ios/Throwl.xcodeproj/project.pbxproj', - 'utf8', - ); - const androidVersion = nativeValue( - gradle, - /^\s*versionName\s+"([^"]+)"\s*$/gm, - 'Android version', - ); - const iosVersion = nativeValue( - xcode, - /^\s*MARKETING_VERSION\s*=\s*([\d.]+);\s*$/gm, - 'iOS version', - ); - if (androidVersion !== version || iosVersion !== version) - throw new Error('Native versions must match the tag.'); - - result = { - id: snapshot.id, - body: snapshot.body, - version, - androidBuild: nativeValue( - gradle, - /^\s*versionCode\s+(\d+)\s*$/gm, - 'Android build', - ), - iosBuild: nativeValue( - xcode, - /^\s*CURRENT_PROJECT_VERSION\s*=\s*(\d+);\s*$/gm, - 'iOS build', - ), - notes: storeNotes(snapshot.body), - }; -} else if (command === 'ready') { - const draft = await readJson(currentDraft); - if ( - !draft.draft || - draft.id !== snapshot.id || - draft.body !== snapshot.body - ) { - throw new Error( - 'The GitHub draft changed during preparation. Rerun with the current notes.', - ); - } - const body = draft.body.replace( - /^\s*(?:\*\*(?:Production review drafts have not been prepared|Both stores are ready to submit)\.\*\*[^\r\n]*\s*)?/, - '', - ); - result = { - body: `\n**Both stores are ready to submit.** Open App Store Connect and Play Console to send each release for review.\n\n${body}`, - }; -} else { - throw new Error('Expected snapshot or ready.'); -} -await writeFile(output, JSON.stringify(result)); From 3443a2ba3137284792444efef9b3b192b2d7cee2 Mon Sep 17 00:00:00 2001 From: Bart de Lange Date: Fri, 27 Nov 2026 16:16:28 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A7=B9=20chore(config):=20Submit=20an?= =?UTF-8?q?d=20release=20both=20stores=20after=20approval?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-throwl.yaml | 8 ++++---- CONTRIBUTING.md | 13 ++++++------- apps/throwl/fastlane/Fastfile | 10 +++++----- apps/throwl/fastlane/store-release-notes.md | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release-throwl.yaml b/.github/workflows/release-throwl.yaml index c2024ba9..a35cbe6f 100644 --- a/.github/workflows/release-throwl.yaml +++ b/.github/workflows/release-throwl.yaml @@ -116,7 +116,7 @@ jobs: IOS_GOOGLE_SERVICE_INFO_PLIST_B64: ${{ secrets.IOS_GOOGLE_SERVICE_INFO_PLIST_B64 }} prepare: - name: Submit iOS for review and prepare Google Play production + name: Submit both tested builds for store review needs: [deploy_android, deploy_ios] if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && !github.event.repository.fork concurrency: @@ -200,11 +200,11 @@ jobs: APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} - - name: Prepare Play Console production release + - name: Submit tested Android build for production review id: android continue-on-error: true working-directory: apps/throwl - run: bundle exec fastlane android prepare_tested_build "build:$BUILD_NUMBER" "notes:$RUNNER_TEMP/store-notes.json" + run: bundle exec fastlane android submit_tested_build "build:$BUILD_NUMBER" "notes:$RUNNER_TEMP/store-notes.json" env: BUILD_NUMBER: ${{ steps.release.outputs.android_build }} PLAY_CONFIG_JSON: ${{ secrets.PLAY_CONFIG_JSON }} @@ -221,7 +221,7 @@ jobs: gh api "repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" > "$RUNNER_TEMP/current-draft.json" jq -e --slurpfile original "$RUNNER_TEMP/draft.json" ' if .draft and .body == $original[0].body then - {body: ("\n**iOS submitted for App Review. Android prepared for manual submission in Play Console.**\n\n" + + {body: ("\n**Both builds were submitted to their stores for review.** Each store publishes after approval.\n\n" + (.body | sub("^\\s*\\*\\*[^\\r\\n]*\\s*"; "")))} else error("The GitHub draft changed during store preparation; update its status manually") end ' "$RUNNER_TEMP/current-draft.json" > "$RUNNER_TEMP/ready.json" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 050d4f3e..21d7e303 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -139,13 +139,12 @@ writing to either store. The App Store Connect key needs permission to submit versions for review, and the Play service account needs permission to edit production releases. The workflow reuses the existing Actions credentials. -Approving the job submits the tested iOS build to App Review and sets manual -App Store release after approval. On Google Play it promotes the tested build -to production with changes left unsent. Before approving, check that Play has -no active production review or rollout. Fastlane's promotion uses Google's -default handling for an existing review. In Play Console, send the changes -for review manually. Use managed publishing if Play should wait for a manual -rollout after review. +Approving the job submits both tested builds for production review. Apple +releases automatically after approval. For Google to publish automatically +after approval, turn off Managed publishing in Play Console. Before +approving, check that Play has no active production review or rollout. +Fastlane's promotion uses Google's default handling for an existing review. +Each store can approve and publish on its own schedule. After both lanes succeed, the workflow records their outcomes on the GitHub draft. Publish that draft separately. If one lane fails, check both store diff --git a/apps/throwl/fastlane/Fastfile b/apps/throwl/fastlane/Fastfile index b09ff3be..4c261374 100644 --- a/apps/throwl/fastlane/Fastfile +++ b/apps/throwl/fastlane/Fastfile @@ -72,7 +72,7 @@ platform :ios do ) end - desc "Submit the approved TestFlight build for App Review with manual release" + desc "Submit the approved TestFlight build for automatic release after App Review" lane :submit_tested_build do |options| notes = JSON.parse(File.read(options.fetch(:notes))) deliver( @@ -87,7 +87,7 @@ platform :ios do skip_screenshots: true, force: true, run_precheck_before_submit: false, - automatic_release: false, + automatic_release: true, submit_for_review: true ) end @@ -130,8 +130,8 @@ platform :android do ) end - desc "Promote the approved Play Internal build to production without sending it for review" - lane :prepare_tested_build do |options| + desc "Promote the approved Play Internal build and send it for production review" + lane :submit_tested_build do |options| code = Integer(options.fetch(:build)) Dir.mktmpdir("throwl-play-release") do |temporary| metadata = File.join(temporary, "metadata") @@ -154,7 +154,7 @@ platform :android do skip_upload_metadata: true, skip_upload_images: true, skip_upload_screenshots: true, - changes_not_sent_for_review: true, + changes_not_sent_for_review: false, rescue_changes_not_sent_for_review: false ) end diff --git a/apps/throwl/fastlane/store-release-notes.md b/apps/throwl/fastlane/store-release-notes.md index 02235f36..6dc555ba 100644 --- a/apps/throwl/fastlane/store-release-notes.md +++ b/apps/throwl/fastlane/store-release-notes.md @@ -1,6 +1,6 @@ -**Production review drafts have not been prepared.** Add the release notes, test both builds, and approve the workflow. +**Store review is pending.** Add the release notes, test both builds, and approve the workflow to submit them. ## Changes