Skip to content

2nd Week of 2022

Computer Science

CICD

Github Actions

  • New: Store file as a secret.

    If you want to store a file (multiline, binary...) as a secret, first encode it with base64:

    base64 -i < {{ file_path }} | tr -d '\n' | xclip -i -selection clipboard
    

    Then paste it to a new secret. To restore the file diring the workflow, add:

    - name: restore file
      run: echo ${{ secrets.SECRET }} | base64 -d > {{ file_path }}
    

GNULinux

Android

  • New: Automatic version code generation.

    If you use semantic versioning and you don't want to increment the version code manually, replace the related config from android/app/build.gradle with:

    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0.0'
    }
    
    def semanticVersion = flutterVersionName.split('\\+')
    def versionCore = semanticVersion[0]
    def build = semanticVersion.length >= 2 ? semanticVersion[1].toInteger() : 0
    def (major, minor, patch) = versionCore.tokenize('.').collect{it.toInteger()}
    def flutterVersionCode = 1000000 * major + 10000 * minor + 100 * patch + build
    

    Then whenever pubspec.yaml version veriable changes and you build an APK or appbundle, the version code will be generated from it.

    Examples (version name -> version code):

    • 1.2.0 -> 1020000
    • 3.0.1+99 -> 3000199
  • New: Signing the APK/AppBundle.

    First of all, create a key if you don't have one with:

    keytool -genkey -v -keystore {{ keystore_file }} -alias {{ key_alias }} \
      -keyalg RSA -keysize 4096 -validity 10000
    

    Replace signingConfigs with:

      signingConfigs {
           release {
            keyAlias "$System.env.KEY_ALIAS"
            keyPassword "$System.env.KEY_PASSWORD"
            storeFile file("$System.env.KEY_PATH")
            storePassword "$System.env.STORE_PASSWORD"
        }
       }
       buildTypes {
           release {
               signingConfig signingConfigs.release
           }
       }
    

    Now, you can set the corresponding environment variables. This configuration is particularily useful if you want to have a CI build and sign the releases.

    Check store file as secret to save the generated keystore file as a CI secret.

Makefile

  • New: Paralelize steps.

    Add the following lines to the beginning of the Makefile:

    NPROCS = $(shell grep -c 'processor' /proc/cpuinfo)
    MAKEFLAGS += -j$(NPROCS)
    

Profanity

  • New: Most common commands.

    • \msg {user@server.tld}: Start a conversation.
    • \roster add {user@server.tld}: Add user to contacts.
    • \sub request {user@server.tld}: Request presence updates from user.
    • \omemo start: Start an OMEMO session.

Wallabag

  • New: Block all feeds except starred.

    location ~ /feed/sgn/{token}/(?!starred) {
       deny all;
       return 403;
      }
    
  • Correction: Missing placeholder.

Programming

Material

  • New: InkWell.

    Make a component clickable (with animations onf hover and tap):

    InkWell(
        onTap: () {
          // To do
        },
        child: Card(),
    )
    

Other

  • New: Request a new certificate.

    If there is no HTTP sever running:

    certbot certonly --standalone --preferred-challenges http-01 -d {{ domain }} --register-unsafely-without-email --agree-tos -n
    

    If there is an HTTP running:

    certonly --webroot -w {{ web_path_letsencrypt }} --preferred-challenges http-01 -d {{ domain }} --register-unsafely-without-email --agree-tos -n
    
  • Correction: Add missing entries to nav.

  • New: Upload to Play Store with CI.

    1. Create a principal in https://console.cloud.google.com/iam-admin/iam with the role Service Account User.
    2. Create and download a new key (JSON format) for the created principal.
    3. In Play Console go to Setup>API access and enable access for the created principal granting Admin (all permissions) to it.
    4. Add the key JSON content as a GitHub Secret (e.g., SERVICE_ACCOUNT_JSON).
    5. Add the following step to your workflow (after flutter build appbundle):
    - name: Upload to Google Play
      uses: r0adkll/upload-google-play@v1.0.15
      with:
        serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
        packageName: {{ package_name }}
        releaseFiles: build/app/outputs/bundle/release/app-release.aab
        track: production