CI: Add release workflow

This commit is contained in:
Krille 2023-07-15 09:37:55 +09:00
commit 53d25548dc
No known key found for this signature in database
6 changed files with 185 additions and 73 deletions

View file

@ -1,37 +0,0 @@
#!/bin/bash -ve
# source: https://about.gitlab.com/blog/2017/09/05/how-to-automatically-create-a-new-mr-on-gitlab-with-gitlab-ci/
# Extract the host where the server is running, and add the URL to the APIs
[[ $HOST =~ ^https?://[^/]+ ]] && HOST="${BASH_REMATCH[0]}/api/v4/projects/"
# Look which is the default branch
TARGET_BRANCH=`curl --silent "${HOST}${CI_PROJECT_ID}" --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" | python3 -c "import sys, json; print(json.load(sys.stdin)['default_branch'])"`;
# The description of our new MR, we want to remove the branch after the MR has
# been closed
BODY="{
\"id\": ${CI_PROJECT_ID},
\"source_branch\": \"${UPDATE_BRANCH}\",
\"target_branch\": \"${TARGET_BRANCH}\",
\"remove_source_branch\": true,
\"title\": \"chore: automated dependency update\"
}";
# Require a list of all the merge request and take a look if there is already
# one with the same source branch
LISTMR=`curl --silent "${HOST}${CI_PROJECT_ID}/merge_requests?state=opened" --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}"`;
COUNTBRANCHES=`echo ${LISTMR} | grep -o "\"source_branch\":\"${UPDATE_BRANCH}\"" | wc -l`;
# No MR found, let's create a new one
if [ ${COUNTBRANCHES} -eq "0" ]; then
curl -X POST "${HOST}${CI_PROJECT_ID}/merge_requests" \
--header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" \
--header "Content-Type: application/json" \
--data "${BODY}";
echo "Opened a new dependency update MR."
exit;
fi
echo "No new merge request opened.";

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
flutter pub get
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
mkdir -p build/android
cp build/app/outputs/bundle/release/app-release.aab build/android/
cd android
bundle install
bundle update fastlane
bundle exec fastlane deploy_internal_test
cd ..

View file

@ -1,9 +0,0 @@
#!/bin/sh -ve
RELEASE_TYPE=$(echo $CI_COMMIT_TAG | grep -oE "[a-z]+")
cd android
if [ "$RELEASE_TYPE" = "rc" ]; then
bundle exec fastlane deploy_candidate
else
bundle exec fastlane deploy_release
fi
cd ..