#!/usr/bin/env ruby
# frozen_string_literal: true

require "fileutils"
require "yaml"

config = YAML.load_file(File.join(__dir__, "..", "bumpver.yml"))
version = config["current_version"]
build = version.match(/\d{4}\.\d{2}\.(\d+)/)[1].to_i
next_build = build + 1

path = "fastlane/metadata/android/en-US/changelogs/#{next_build}.txt"
full_path = File.join(__dir__, "..", path)

FileUtils.touch(full_path)

puts "Added changelog for next build (#{next_build})"
puts "./#{path}"

exec("code", full_path)
