Git Product home page Git Product logo

android-version-actions's Introduction

Hi there ๐Ÿ‘‹

chkfung's github stats

android-version-actions's People

Contributors

actions-user avatar chkfung avatar dependabot[bot] avatar mp3killa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

android-version-actions's Issues

Current versionName and versionCode?

How do you get the current versionName and versionCode?
My use case is to append some text into the versionName.
For example, current versionName is "1.2.3", then I want it to be "1.2.3-hotfix"

Cannot read property 'replace' of undefined

My current internal release is 3 (1.0.3), so I would expect Version Code : 6 to replace the current release.

Testing:
Increasing versionCode in gradle to match the number from the GitHub run - this produces the same error.

Run chkfung/[email protected]
with:
gradlePath: app/build.gradle
versionCode: 6
versionName: 1.0.4
env:
JAVA_HOME_11.0.11_x64: /opt/hostedtoolcache/jdk/11.0.11/x64
JAVA_HOME: /opt/hostedtoolcache/jdk/11.0.11/x64
JAVA_HOME_11_0_11_X64: /opt/hostedtoolcache/jdk/11.0.11/x64
Gradle Path : app/build.gradle
Version Code : 6
Version Name : 1.0.4
/home/runner/work/_actions/chkfung/android-version-actions/v1.1/index.js:21
newGradle = newGradle.replace(versionCodeRegexPattern, $1$***versionCode***);
^

TypeError: Cannot read property 'replace' of undefined
at ReadFileContext.callback (/home/runner/work/_actions/chkfung/android-version-actions/v1.1/index.js:21:35)
at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:239:13)

Regex matches versionCode in comments

I was scratching my head why this action wasn't working for me. After some debugging I realized that it had managed to replace versionCode in a comment (e.g. // Here's a sentence with versionCode in it). The replacement mechanism needs to be a bit more robust. At the very least a regex that doesn't match on a comment line.

BuildConfig.VERSION_CODE is still set to default value.

Hello,

I want to show the current build version code on the login screen of my application. I am showing the BuildConfig.VERSION_CODE to get the value, but it is still set to default value and is not overridden during build of the apk on Github:

Row {
        Text(text = "App version: ${BuildConfig.VERSION_CODE}")
}

I am using this to increment the version code in github action workflow, which works fine and the version code is incremented:

- name: Set version code and version name
        uses: chkfung/[email protected]
        with:
          gradlePath: app/build.gradle.kts
          versionCode: ${{github.run_number}}
          versionName: app_1.0.0_${{github.run_number}}

Thank you.

Multi Flavor Version Name

Hey @chkfung, thanks for the plugin.
Is it feasible for you to put replaceAll in place of newGradle = newGradle.replace(versionCodeRegexPattern, $1${versionCode}); and same for versionName because we have multiple productFlavours with each flavour having its own versionCode and versionName, but it only replaces just the first occurrence.

Originally posted by @alisultan-cloaked in #2 (comment)

TypeError: Cannot read property 'replace' of undefined

Using following code:

      - uses: actions/checkout@v2
      - name: set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Bump version
        uses: chkfung/[email protected]
        with:
          gradlePath: app/build.gradle
          versionCode: ${{github.run_number}}
          versionName: 1.0.8

Failing with following error message:

**Run chkfung/[email protected]
Gradle Path : app/build.gradle
Version Code : 17
Version Name : 1.0.8
/home/runner/work/_actions/chkfung/android-version-actions/v1.1/index.js:21
newGradle = newGradle.replace(versionCodeRegexPattern, $1$***versionCode***);
^

TypeError: Cannot read property 'replace' of undefined
at ReadFileContext.callback (/home/runner/work/_actions/chkfung/android-version-actions/v1.1/index.js:21:35)
at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:261:13)**

`app/build.gradle` does not seem to get updated

Hi! I would like to use this plug-in to update our versionCode and versionName using GitHub Actions, but I do not seem to be getting any results. I am new to using GitHub actions, and so I could be doing something wrong. The file I created is .github/workflows/android-version-action.yml and looks like this:

name: Bump the version code
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Bump version
        uses: chkfung/[email protected]
        with:
          gradlePath: app/build.gradle # or app/build.gradle.kts 
          versionCode: ${{github.run_number}}
          versionName: 1.0.0

This is the output of the "Bump version" step in the workflow:

Run chkfung/[email protected]
  with:
    gradlePath: app/build.gradle
    versionCode: 4
    versionName: 1.0.0
  env:
    JAVA_HOME_8.0.302_x64: /opt/hostedtoolcache/jdk/8.0.302/x64
    JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.302/x64
    JAVA_HOME_8_0_302_X64: /opt/hostedtoolcache/jdk/8.0.302/x64
Gradle Path : app/build.gradle
Version Code : 4
Version Name : 1.0.0
Successfully override version code 4
Successfully override version code 1.0.0

I would expect the build.gradle file to contain versionCode 4 and versionName 1.0.0 but nothing seems to have happened. Thanks for making this plug-in and I appreciate any help or support!

Action does not respect the job's `working-directory`

Thanks for this great action!

My problem is that the job that includes this action has the following properties set for the job (it's a monorepo with servers, web apps and several Android apps):

    defaults:
      run:
        working-directory: ./Apps/Android/Root

When I try to use the action:

      - name: + Bump Android App #1 version
        uses: chkfung/[email protected]
        with:
          gradlePath: app-one/build.gradle
          versionCode: ${{ env.ANDROID_BUILD_CODE }}

the action fails, but if I change it to:

      - name: + Bump Android App #1 version
        uses: chkfung/[email protected]
        with:
          gradlePath: Apps/Android/Root/app-one/build.gradle
          versionCode: ${{ env.ANDROID_BUILD_CODE }}

then the action works correctly.

PROBLEM: The action should respect the job's working-directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.