#!/bin/bash

set -e

cd ios
fastlane ios release_prod
cd ../android
fastlane android release_prod
cd ..



VERSION_LINE=$(grep '^version:' pubspec.yaml | head -n 1)
VERSION=$(echo "$VERSION_LINE" | cut -d':' -f2 | cut -d'+' -f1 | xargs)
BUILD=$(echo "$VERSION_LINE" | cut -d'+' -f2 | xargs)
TAG="v${VERSION}+${BUILD}"

git tag "$TAG"
git push origin "$TAG"