From 112530f2d3e9cdca2371ea2e900e2f55cafb9485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Mon, 4 Sep 2023 21:19:26 +0200 Subject: [PATCH 1/9] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20L?= =?UTF-8?q?egger=20til=20appcenter=20prebuild=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 2 +- appcenter-pre-build.sh | 13 +++++++++++++ ios/RNSkolenApp.xcodeproj/project.pbxproj | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 appcenter-pre-build.sh diff --git a/android/app/build.gradle b/android/app/build.gradle index aae1309..b9898a6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -80,7 +80,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "1.0.0-leiferik" + versionName "1.0.0" } signingConfigs { debug { diff --git a/appcenter-pre-build.sh b/appcenter-pre-build.sh new file mode 100644 index 0000000..cf1dc35 --- /dev/null +++ b/appcenter-pre-build.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Sett versjonen på iOS +if [ "$APPCENTER_BRANCH" != "master" ]; then + echo "Setting iOS version to $APPCENTER_BRANCH" + plutil -replace CFBundleShortVersionString -string "$APPCENTER_BRANCH" ios/RNSkolenApp/Info.plist +fi + +# Sett versjonen på Android +if [ "$APPCENTER_BRANCH" != "master" ]; then + echo "Setting Android version to $APPCENTER_BRANCH" + sed -i "s/versionName \".*\"/versionName \"$APPCENTER_BRANCH\"/" android/app/build.gradle +fi \ No newline at end of file diff --git a/ios/RNSkolenApp.xcodeproj/project.pbxproj b/ios/RNSkolenApp.xcodeproj/project.pbxproj index 4b2e325..9ff187b 100644 --- a/ios/RNSkolenApp.xcodeproj/project.pbxproj +++ b/ios/RNSkolenApp.xcodeproj/project.pbxproj @@ -497,7 +497,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = "1.0.0-leiferik"; + MARKETING_VERSION = 1.0.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -524,7 +524,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = "1.0.0-leiferik"; + MARKETING_VERSION = 1.0.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", From f8bb548b38ac9aadc9df54834fe4462fa9dd8a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Mon, 4 Sep 2023 21:21:36 +0200 Subject: [PATCH 2/9] Appcenter likte ikke gitmoji --- app/App.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/App.tsx b/app/App.tsx index f1ea23c..9e89108 100644 --- a/app/App.tsx +++ b/app/App.tsx @@ -1,10 +1,3 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - */ - import React from 'react'; import type {PropsWithChildren} from 'react'; import { From df27ced67743534fe17a7a2ad1581242520fa287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Mon, 4 Sep 2023 21:40:14 +0200 Subject: [PATCH 3/9] Legger til APPCENTER_SOURCE_DIRECTORY --- appcenter-pre-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appcenter-pre-build.sh b/appcenter-pre-build.sh index cf1dc35..e7316af 100644 --- a/appcenter-pre-build.sh +++ b/appcenter-pre-build.sh @@ -3,11 +3,11 @@ # Sett versjonen på iOS if [ "$APPCENTER_BRANCH" != "master" ]; then echo "Setting iOS version to $APPCENTER_BRANCH" - plutil -replace CFBundleShortVersionString -string "$APPCENTER_BRANCH" ios/RNSkolenApp/Info.plist + plutil -replace CFBundleShortVersionString -string "$APPCENTER_BRANCH" $APPCENTER_SOURCE_DIRECTORY/ios/RNSkolenApp/Info.plist fi # Sett versjonen på Android if [ "$APPCENTER_BRANCH" != "master" ]; then echo "Setting Android version to $APPCENTER_BRANCH" - sed -i "s/versionName \".*\"/versionName \"$APPCENTER_BRANCH\"/" android/app/build.gradle + sed -i "s/versionName \".*\"/versionName \"$APPCENTER_BRANCH\"/" $APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle fi \ No newline at end of file From 21529998765f9bbf4a35c2f823eeaf7bd93d30ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Mon, 4 Sep 2023 22:08:32 +0200 Subject: [PATCH 4/9] Justerer script --- appcenter-pre-build.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/appcenter-pre-build.sh b/appcenter-pre-build.sh index e7316af..df43a2a 100644 --- a/appcenter-pre-build.sh +++ b/appcenter-pre-build.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash -# Sett versjonen på iOS -if [ "$APPCENTER_BRANCH" != "master" ]; then - echo "Setting iOS version to $APPCENTER_BRANCH" - plutil -replace CFBundleShortVersionString -string "$APPCENTER_BRANCH" $APPCENTER_SOURCE_DIRECTORY/ios/RNSkolenApp/Info.plist -fi -# Sett versjonen på Android if [ "$APPCENTER_BRANCH" != "master" ]; then - echo "Setting Android version to $APPCENTER_BRANCH" - sed -i "s/versionName \".*\"/versionName \"$APPCENTER_BRANCH\"/" $APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle -fi \ No newline at end of file + if [ -n "$APPCENTER_XCODE_PROJECT" ]; then + echo "Setting iOS version to $APPCENTER_BRANCH" + plutil -replace CFBundleShortVersionString -string "$APPCENTER_BRANCH" $APPCENTER_SOURCE_DIRECTORY/ios/RNSkolenApp/Info.plist + fi + if [ -n "$APPCENTER_ANDROID_VARIANT" ]; then + echo "Setting Android version to $APPCENTER_BRANCH" + sed -i '' "s/versionName \".*\"/versionName \"$APPCENTER_BRANCH\"/" $APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle + fi +fi From 3b127e2a8371e4352cbe942f00a4a1bb679cd843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Tue, 5 Sep 2023 08:36:45 +0200 Subject: [PATCH 5/9] =?UTF-8?q?Bytter=20til=20=C3=A5=20bruke=20branchname?= =?UTF-8?q?=20i=20github=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-custom-codepush.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-custom-codepush.yml b/.github/workflows/build-custom-codepush.yml index 9d3f83e..8ea1f41 100644 --- a/.github/workflows/build-custom-codepush.yml +++ b/.github/workflows/build-custom-codepush.yml @@ -1,12 +1,6 @@ name: Lag CodePush 🚀 -on: - workflow_dispatch: - inputs: - targetVersion: - description: 'Target version, feks: 1.0.0-' - required: true - default: '1.0.0-leiferik' +on: workflow_dispatch jobs: build_codepush: runs-on: macos-13 @@ -16,7 +10,7 @@ jobs: fetch-depth: 1 - run: | - echo "Target version: ${{ github.event.inputs.targetVersion }}" + echo "Target version: ${{ github.head_ref }}" - name: NPM install CI run: npm ci @@ -27,5 +21,5 @@ jobs: - name: Bygg CodePush run: | npx appcenter login --token ${{ secrets.APPCENTER_API_TOKEN }} - npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp -d Staging -t ${{ github.event.inputs.targetVersion }} --description "${{ github.event.inputs.targetVersion }}-${{ steps.timestamp.outputs.timestamp }}" - npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp-Android -d Staging -t ${{ github.event.inputs.targetVersion }} --description "${{ github.event.inputs.targetVersion }}-${{ steps.timestamp.outputs.timestamp }}" + npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp -d Staging -t ${{ github.head_ref }} --description "${{ github.head_ref }}-${{ steps.timestamp.outputs.timestamp }}" + npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp-Android -d Staging -t ${{ github.head_ref }} --description "${{ github.head_ref }}-${{ steps.timestamp.outputs.timestamp }}" From 395fc5443420f0df3f085ee4afaf17d241ba7c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Tue, 5 Sep 2023 08:45:00 +0200 Subject: [PATCH 6/9] Bytter til ref_name --- .github/workflows/build-custom-codepush.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-custom-codepush.yml b/.github/workflows/build-custom-codepush.yml index 8ea1f41..cb4c05d 100644 --- a/.github/workflows/build-custom-codepush.yml +++ b/.github/workflows/build-custom-codepush.yml @@ -10,7 +10,7 @@ jobs: fetch-depth: 1 - run: | - echo "Target version: ${{ github.head_ref }}" + echo "Target version: ${{ github.ref_name }}" - name: NPM install CI run: npm ci @@ -21,5 +21,5 @@ jobs: - name: Bygg CodePush run: | npx appcenter login --token ${{ secrets.APPCENTER_API_TOKEN }} - npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp -d Staging -t ${{ github.head_ref }} --description "${{ github.head_ref }}-${{ steps.timestamp.outputs.timestamp }}" - npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp-Android -d Staging -t ${{ github.head_ref }} --description "${{ github.head_ref }}-${{ steps.timestamp.outputs.timestamp }}" + npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp -d Staging -t ${{ github.ref_name }} --description "${{ github.ref_name }}-${{ steps.timestamp.outputs.timestamp }}" + npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp-Android -d Staging -t ${{ github.ref_name }} --description "${{ github.ref_name }}-${{ steps.timestamp.outputs.timestamp }}" From c4375bd43da7abf19ce2278bbbb05623d9faa83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Tue, 5 Sep 2023 09:32:15 +0200 Subject: [PATCH 7/9] =?UTF-8?q?Bytter=20tilbake=20for=20=C3=A5=20st=C3=B8t?= =?UTF-8?q?te=20semver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-custom-codepush.yml | 14 ++++++++++---- android/app/build.gradle | 2 +- ios/RNSkolenApp.xcodeproj/project.pbxproj | 4 ---- ios/RNSkolenApp/Info.plist | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-custom-codepush.yml b/.github/workflows/build-custom-codepush.yml index cb4c05d..d58ce0a 100644 --- a/.github/workflows/build-custom-codepush.yml +++ b/.github/workflows/build-custom-codepush.yml @@ -1,6 +1,12 @@ name: Lag CodePush 🚀 -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + targetVersion: + description: 'Versjonsnavn fra AppCenter, feks: 1.0.0-' + required: true + default: '1.0.0-appcenter_script' jobs: build_codepush: runs-on: macos-13 @@ -10,7 +16,7 @@ jobs: fetch-depth: 1 - run: | - echo "Target version: ${{ github.ref_name }}" + echo "Target version: ${{ github.event.inputs.targetVersion }}" - name: NPM install CI run: npm ci @@ -21,5 +27,5 @@ jobs: - name: Bygg CodePush run: | npx appcenter login --token ${{ secrets.APPCENTER_API_TOKEN }} - npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp -d Staging -t ${{ github.ref_name }} --description "${{ github.ref_name }}-${{ steps.timestamp.outputs.timestamp }}" - npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp-Android -d Staging -t ${{ github.ref_name }} --description "${{ github.ref_name }}-${{ steps.timestamp.outputs.timestamp }}" + npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp -d Staging -t ${{ github.event.inputs.targetVersion }} --description "${{ github.event.inputs.targetVersion }}-${{ steps.timestamp.outputs.timestamp }}" + npx appcenter codepush release-react -a leif.erik.bjorkli-BEKK.no/RNSkolenApp-Android -d Staging -t ${{ github.event.inputs.targetVersion }} --description "${{ github.event.inputs.targetVersion }}-${{ steps.timestamp.outputs.timestamp }}" diff --git a/android/app/build.gradle b/android/app/build.gradle index b9898a6..2dc6eba 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -80,7 +80,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "1.0.0" + versionName "1.0.1" } signingConfigs { debug { diff --git a/ios/RNSkolenApp.xcodeproj/project.pbxproj b/ios/RNSkolenApp.xcodeproj/project.pbxproj index 9ff187b..ea513ce 100644 --- a/ios/RNSkolenApp.xcodeproj/project.pbxproj +++ b/ios/RNSkolenApp.xcodeproj/project.pbxproj @@ -489,7 +489,6 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = J879L9U3CQ; ENABLE_BITCODE = NO; INFOPLIST_FILE = RNSkolenApp/Info.plist; @@ -497,7 +496,6 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -517,14 +515,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = J879L9U3CQ; INFOPLIST_FILE = RNSkolenApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/ios/RNSkolenApp/Info.plist b/ios/RNSkolenApp/Info.plist index 37cbacd..4d41511 100644 --- a/ios/RNSkolenApp/Info.plist +++ b/ios/RNSkolenApp/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - $(MARKETING_VERSION) + 1.0.1 CFBundleSignature ???? CFBundleVersion From cdf761c63a56c3a0adad6ed00812a8698a773da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Tue, 5 Sep 2023 10:51:43 +0200 Subject: [PATCH 8/9] Oppdaterer prebuild script --- appcenter-pre-build.sh | 14 +++++++++----- ios/RNSkolenApp.xcodeproj/project.pbxproj | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/appcenter-pre-build.sh b/appcenter-pre-build.sh index df43a2a..9339f74 100644 --- a/appcenter-pre-build.sh +++ b/appcenter-pre-build.sh @@ -3,11 +3,15 @@ if [ "$APPCENTER_BRANCH" != "master" ]; then if [ -n "$APPCENTER_XCODE_PROJECT" ]; then - echo "Setting iOS version to $APPCENTER_BRANCH" - plutil -replace CFBundleShortVersionString -string "$APPCENTER_BRANCH" $APPCENTER_SOURCE_DIRECTORY/ios/RNSkolenApp/Info.plist + current_version=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$APPCENTER_SOURCE_DIRECTORY/ios/RNSkolenApp/Info.plist") + new_version="$current_version-$APPCENTER_BRANCH" + echo "Setting iOS version to $new_version" + /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $new_version" "$APPCENTER_SOURCE_DIRECTORY/ios/RNSkolenApp/Info.plist" fi if [ -n "$APPCENTER_ANDROID_VARIANT" ]; then - echo "Setting Android version to $APPCENTER_BRANCH" - sed -i '' "s/versionName \".*\"/versionName \"$APPCENTER_BRANCH\"/" $APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle + current_version=$(grep -o 'versionName "[^"]*"' "$APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle" | cut -d '"' -f 2) + new_version="$current_version-$APPCENTER_BRANCH" + echo "Setting Android version to $new_version" + sed -i '' "s/versionName \"$current_version\"/versionName \"$new_version\"/" "$APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle" fi -fi +fi \ No newline at end of file diff --git a/ios/RNSkolenApp.xcodeproj/project.pbxproj b/ios/RNSkolenApp.xcodeproj/project.pbxproj index ea513ce..4539cad 100644 --- a/ios/RNSkolenApp.xcodeproj/project.pbxproj +++ b/ios/RNSkolenApp.xcodeproj/project.pbxproj @@ -489,6 +489,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = J879L9U3CQ; ENABLE_BITCODE = NO; INFOPLIST_FILE = RNSkolenApp/Info.plist; @@ -515,6 +516,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = J879L9U3CQ; INFOPLIST_FILE = RNSkolenApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( From b203108b70b6df7f16be247641beff0314846206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20Erik=20Bj=C3=B8rkli?= Date: Tue, 5 Sep 2023 12:23:31 +0200 Subject: [PATCH 9/9] =?UTF-8?q?Enderer=20p=C3=A5=20placeholder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-custom-codepush.yml | 2 +- appcenter-pre-build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-custom-codepush.yml b/.github/workflows/build-custom-codepush.yml index d58ce0a..559e34e 100644 --- a/.github/workflows/build-custom-codepush.yml +++ b/.github/workflows/build-custom-codepush.yml @@ -6,7 +6,7 @@ on: targetVersion: description: 'Versjonsnavn fra AppCenter, feks: 1.0.0-' required: true - default: '1.0.0-appcenter_script' + default: '1.0.0-appcenter-script' jobs: build_codepush: runs-on: macos-13 diff --git a/appcenter-pre-build.sh b/appcenter-pre-build.sh index 9339f74..848038a 100644 --- a/appcenter-pre-build.sh +++ b/appcenter-pre-build.sh @@ -14,4 +14,4 @@ if [ "$APPCENTER_BRANCH" != "master" ]; then echo "Setting Android version to $new_version" sed -i '' "s/versionName \"$current_version\"/versionName \"$new_version\"/" "$APPCENTER_SOURCE_DIRECTORY/android/app/build.gradle" fi -fi \ No newline at end of file +fi