diff --git a/.github/workflows/buildCordova.yml b/.github/workflows/buildCordova.yml index ec00923f744c..02f2161d66ab 100644 --- a/.github/workflows/buildCordova.yml +++ b/.github/workflows/buildCordova.yml @@ -42,12 +42,12 @@ jobs: id: versionNumber uses: actions/github-script@v6 env: - VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}-development-${{ github.run_number }} + VERSION_NUMBER_DEVELOPMENT: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }} 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 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') diff --git a/.github/workflows/releaseCordova.yml b/.github/workflows/releaseCordova.yml index 8e6d36b17bf6..783f1ef3eb0f 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 }} + VERSION_NUMBER_RELEASE: ${{ env.PACKAGE_VERSION }}.${{ github.run_number }} with: result-encoding: string script: | @@ -115,7 +115,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 diff --git a/_scripts/cordova-build.js b/_scripts/cordova-build.js index b64b4110eda6..e8451eb54c4b 100644 --- a/_scripts/cordova-build.js +++ b/_scripts/cordova-build.js @@ -413,8 +413,15 @@ 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 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 configXML.widget.author[0].$.href = sourcePackage.author.url @@ -482,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 } }())