From 8706ef29f739feb7be8a73a7092ef958104d00dc Mon Sep 17 00:00:00 2001 From: Emma Date: Sat, 14 Jan 2023 21:45:51 -0500 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=94=A7Adjust=20release=20version=20nu?= =?UTF-8?q?mber?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ; this is related to MarmadileManteater/FreeTubeCordova#78. --- .github/workflows/releaseCordova.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/releaseCordova.yml b/.github/workflows/releaseCordova.yml index 8e6d36b17bf6..5c9ff470d48e 100644 --- a/.github/workflows/releaseCordova.yml +++ b/.github/workflows/releaseCordova.yml @@ -36,22 +36,12 @@ jobs: - name: Set Version Number Variable id: versionNumber uses: actions/github-script@v6 - env: - IS_DEV: ${{ contains(github.ref, 'development') }} - IS_NIGHTLY: ${{ contains(github.ref, 'release') }} - VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}-development-${{ github.run_number }} - VERSION_NUMBER_NIGHTLY: ${{ env.PACKAGE_VERSION }}-nightly-${{ github.run_number }} - VERSION_NUMBER_RELEASE: ${{ env.PACKAGE_VERSION }}-unofficial with: result-encoding: string script: | - if (${{ env.IS_DEV }}) { - return "${{ env.VERSION_NUMBER_DEVELOPMENT }}" - } else if (${{ env.IS_NIGHTLY }}) { - return "${{ env.VERSION_NUMBER_NIGHTLY }}" - } else { - return "${{env.VERSION_NUMBER_RELEASE }}" - } + const [ packageVersion, runNumber ] = ["${{ env.PACKAGE_VERSION }}", "${{ github.run_number }}"] + const [ major, minor, patch ] = packageVersion.split(".") + return `${major * 10000000 + minor * 100000 + patch * 1000 + runNumber}` # script: if ${{ env.IS_DEV }} then echo ":token :set-output name=VERSION_NUMBER::${{ env.VERSION_NUMBER_NIGHTLY }}" else echo "::set-output name=VERSION_NUMBER::${{ env.VERSION_NUMBER }}" fi - name: Update package.json version @@ -61,7 +51,6 @@ jobs: field: version value: ${{ steps.versionNumber.outputs.result }} - - name: Install libarchive-tools if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-x64') run: sudo apt -y install libarchive-tools; echo "Version Number ${{ toJson(job) }} ${{ toJson(needs) }}" @@ -115,7 +104,7 @@ jobs: with: name: freetube-${{ steps.versionNumber.outputs.result }}.zip path: build/freetube/freetube-${{ steps.versionNumber.outputs.result }}.zip - + - name: Create release body run: | echo "${{ github.event.head_commit.message }}" >> release.txt From a8944f652be05d94b6ed6a870b7b5186e03509f7 Mon Sep 17 00:00:00 2001 From: Emma Date: Sat, 14 Jan 2023 21:47:33 -0500 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7Adjust=20development=20version?= =?UTF-8?q?=20number;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this should help me dry run. --- .github/workflows/buildCordova.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/buildCordova.yml b/.github/workflows/buildCordova.yml index ec00923f744c..9db48c364e90 100644 --- a/.github/workflows/buildCordova.yml +++ b/.github/workflows/buildCordova.yml @@ -41,13 +41,13 @@ jobs: - name: Set Version Number Variable id: versionNumber uses: actions/github-script@v6 - env: - VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}-development-${{ github.run_number }} with: result-encoding: string script: | - return "${{ env.VERSION_NUMBER_DEVELOPMENT }}" - + const [ packageVersion, runNumber ] = ["${{ env.PACKAGE_VERSION }}", "${{ github.run_number }}"] + const [ major, minor, patch ] = packageVersion.split(".") + return `${major * 10000000 + minor * 100000 + patch * 1000 + runNumber}` + - name: Update package.json version uses: jossef/action-set-json-field@v2 with: @@ -79,7 +79,7 @@ jobs: - name: Build APK with Cordova with Node.js ${{ matrix.node-version}} if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-x64') run: npm run build:cordova freetube-${{ steps.versionNumber.outputs.result }}.apk cordova ./freetube.keystore ${{ secrets.KEYSTORE_PASSWORD }} - + - name: Upload Cordova APK Artifact uses: actions/upload-artifact@v3 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-x64') From abb4f0afa559fdb1dfd76c60ef8efcce86c9d7f7 Mon Sep 17 00:00:00 2001 From: Emma Date: Sat, 14 Jan 2023 22:11:32 -0500 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=9B=A0=20Set=20version=20code=20expli?= =?UTF-8?q?citly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/buildCordova.yml | 6 +++--- .github/workflows/releaseCordova.yml | 17 ++++++++++++++--- _scripts/cordova-build.js | 2 ++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildCordova.yml b/.github/workflows/buildCordova.yml index 9db48c364e90..05a899aa963e 100644 --- a/.github/workflows/buildCordova.yml +++ b/.github/workflows/buildCordova.yml @@ -41,12 +41,12 @@ jobs: - name: Set Version Number Variable id: versionNumber uses: actions/github-script@v6 + env: + VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }} with: result-encoding: string script: | - const [ packageVersion, runNumber ] = ["${{ env.PACKAGE_VERSION }}", "${{ github.run_number }}"] - const [ major, minor, patch ] = packageVersion.split(".") - return `${major * 10000000 + minor * 100000 + patch * 1000 + runNumber}` + return "${{ env.VERSION_NUMBER_DEVELOPMENT }}" - name: Update package.json version uses: jossef/action-set-json-field@v2 diff --git a/.github/workflows/releaseCordova.yml b/.github/workflows/releaseCordova.yml index 5c9ff470d48e..8ae128c9f9e8 100644 --- a/.github/workflows/releaseCordova.yml +++ b/.github/workflows/releaseCordova.yml @@ -36,12 +36,22 @@ jobs: - name: Set Version Number Variable id: versionNumber uses: actions/github-script@v6 + env: + IS_DEV: ${{ contains(github.ref, 'development') }} + IS_NIGHTLY: ${{ contains(github.ref, 'release') }} + VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}-development-${{ github.run_number }} + VERSION_NUMBER_NIGHTLY: ${{ env.PACKAGE_VERSION }}-nightly-${{ github.run_number }} + VERSION_NUMBER_RELEASE: ${{ env.PACKAGE_VERSION }}-unofficial with: result-encoding: string script: | - const [ packageVersion, runNumber ] = ["${{ env.PACKAGE_VERSION }}", "${{ github.run_number }}"] - const [ major, minor, patch ] = packageVersion.split(".") - return `${major * 10000000 + minor * 100000 + patch * 1000 + runNumber}` + if (${{ env.IS_DEV }}) { + return "${{ env.VERSION_NUMBER_DEVELOPMENT }}" + } else if (${{ env.IS_NIGHTLY }}) { + return "${{ env.VERSION_NUMBER_NIGHTLY }}" + } else { + return "${{env.VERSION_NUMBER_RELEASE }}" + } # script: if ${{ env.IS_DEV }} then echo ":token :set-output name=VERSION_NUMBER::${{ env.VERSION_NUMBER_NIGHTLY }}" else echo "::set-output name=VERSION_NUMBER::${{ env.VERSION_NUMBER }}" fi - name: Update package.json version @@ -51,6 +61,7 @@ jobs: field: version value: ${{ steps.versionNumber.outputs.result }} + - name: Install libarchive-tools if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-x64') run: sudo apt -y install libarchive-tools; echo "Version Number ${{ toJson(job) }} ${{ toJson(needs) }}" diff --git a/_scripts/cordova-build.js b/_scripts/cordova-build.js index b64b4110eda6..32e607fb3a69 100644 --- a/_scripts/cordova-build.js +++ b/_scripts/cordova-build.js @@ -415,6 +415,8 @@ const archiver = require('archiver'); const configXML = await parseXMLString(await fsReadFile(path.join(distDirectory, 'config.xml'))) configXML.widget.$.id = 'io.freetubeapp.' + sourcePackage.name configXML.widget.$.version = sourcePackage.version + const [major, minor, patch, build] = sourcePackage.version.split('.') + configXML.widget.$['android-versionCode'] = `${major * 10000000 + minor * 100000 + patch * 1000 + build}` configXML.widget.author[0].$.email = sourcePackage.author.email configXML.widget.author[0]._ = sourcePackage.author.name configXML.widget.author[0].$.href = sourcePackage.author.url From f6ad47cad5b6eb3a1fe044d5a502d7fe9639d9a2 Mon Sep 17 00:00:00 2001 From: Emma Date: Sat, 14 Jan 2023 22:19:28 -0500 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=94=A7Adjust=20build=20script=20to=20?= =?UTF-8?q?append=20environment=20to=20applicationId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is related to MarmadileManteater/FreeTubeCordova#78. --- .github/workflows/buildCordova.yml | 2 +- .github/workflows/releaseCordova.yml | 6 +++--- _scripts/cordova-build.js | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildCordova.yml b/.github/workflows/buildCordova.yml index 05a899aa963e..02f2161d66ab 100644 --- a/.github/workflows/buildCordova.yml +++ b/.github/workflows/buildCordova.yml @@ -46,7 +46,7 @@ jobs: with: result-encoding: string script: | - return "${{ env.VERSION_NUMBER_DEVELOPMENT }}" + return "${{ env.VERSION_NUMBER_DEVELOPMENT }}-development" - name: Update package.json version uses: jossef/action-set-json-field@v2 diff --git a/.github/workflows/releaseCordova.yml b/.github/workflows/releaseCordova.yml index 8ae128c9f9e8..4f5a2fb3dc86 100644 --- a/.github/workflows/releaseCordova.yml +++ b/.github/workflows/releaseCordova.yml @@ -39,9 +39,9 @@ jobs: env: IS_DEV: ${{ contains(github.ref, 'development') }} IS_NIGHTLY: ${{ contains(github.ref, 'release') }} - VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}-development-${{ github.run_number }} - VERSION_NUMBER_NIGHTLY: ${{ env.PACKAGE_VERSION }}-nightly-${{ github.run_number }} - VERSION_NUMBER_RELEASE: ${{ env.PACKAGE_VERSION }}-unofficial + VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }}-development + VERSION_NUMBER_NIGHTLY: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }}-nightly + VERSION_NUMBER_RELEASE: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }} with: result-encoding: string script: | diff --git a/_scripts/cordova-build.js b/_scripts/cordova-build.js index 32e607fb3a69..e8451eb54c4b 100644 --- a/_scripts/cordova-build.js +++ b/_scripts/cordova-build.js @@ -413,9 +413,14 @@ const archiver = require('archiver'); ` const configXML = await parseXMLString(await fsReadFile(path.join(distDirectory, 'config.xml'))) - configXML.widget.$.id = 'io.freetubeapp.' + sourcePackage.name + configXML.widget.$.id = `io.freetubeapp.${sourcePackage.name}` configXML.widget.$.version = sourcePackage.version - const [major, minor, patch, build] = sourcePackage.version.split('.') + const sourcePackageParts = sourcePackage.version.split('-') + const [major, minor, patch, build] = sourcePackageParts[0].split('.') + // Seperate environments by ID instead of version code + if (sourcePackageParts.length > 1) { + configXML.widget.$.id += `.${sourcePackageParts[1]}` + } configXML.widget.$['android-versionCode'] = `${major * 10000000 + minor * 100000 + patch * 1000 + build}` configXML.widget.author[0].$.email = sourcePackage.author.email configXML.widget.author[0]._ = sourcePackage.author.name @@ -484,6 +489,7 @@ const archiver = require('archiver'); await fsWriteFile(path.join(buildDirectory, apkName, 'manifest.webmanifest'), JSON.stringify(manifest, null, 2)) } } catch (exception) { + const g = 'see not useless' throw exception } }()) From 5e948cf8aba8593c43ec0f6ceaadbca9b9fe4387 Mon Sep 17 00:00:00 2001 From: Emma Date: Sat, 14 Jan 2023 22:25:37 -0500 Subject: [PATCH 5/5] Slightly adjust release workflow version --- .github/workflows/releaseCordova.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releaseCordova.yml b/.github/workflows/releaseCordova.yml index 4f5a2fb3dc86..783f1ef3eb0f 100644 --- a/.github/workflows/releaseCordova.yml +++ b/.github/workflows/releaseCordova.yml @@ -40,7 +40,7 @@ jobs: IS_DEV: ${{ contains(github.ref, 'development') }} IS_NIGHTLY: ${{ contains(github.ref, 'release') }} VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }}-development - VERSION_NUMBER_NIGHTLY: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }}-nightly + VERSION_NUMBER_NIGHTLY: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }} VERSION_NUMBER_RELEASE: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }} with: result-encoding: string