diff --git a/.github/workflows/buildCordova.yml b/.github/workflows/buildCordova.yml index 9db48c364e90a..05a899aa963e6 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 5c9ff470d48e1..8ae128c9f9e89 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 b64b4110eda6a..32e607fb3a697 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