From 6519544a6774d7beb4f36d24cda80c5601dea794 Mon Sep 17 00:00:00 2001 From: kirill ivanov Date: Sat, 29 Mar 2025 09:55:21 +0300 Subject: [PATCH 1/3] refactor(github): useless --- .github/workflows/reusable-android-publish.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-android-publish.yaml b/.github/workflows/reusable-android-publish.yaml index d0b556a8..a30ae281 100644 --- a/.github/workflows/reusable-android-publish.yaml +++ b/.github/workflows/reusable-android-publish.yaml @@ -36,7 +36,7 @@ on: OSSRH_USERNAME: required: false type: string - default: 'github-bot@rees46.com' + default: "github-bot@rees46.com" secrets: SONATA_USERNAME: required: true @@ -85,5 +85,9 @@ jobs: SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_KEY_FILE_AS_BASE64_STRING: ${{ secrets.SIGNING_KEY_FILE_AS_BASE64_STRING }} - - name: Publish - run: ./gradlew publish + - name: Debu signing + run: | + ./gradlew sign --dry-run + + # - name: Publish + # run: ./gradlew publish From fccf19313001371b69c6ea2c9f0309458ecbb1e3 Mon Sep 17 00:00:00 2001 From: kirill ivanov Date: Sat, 29 Mar 2025 10:10:40 +0300 Subject: [PATCH 2/3] refactor(github): reusable android actions refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless refactor(github): useless --- .github/actions/android/prepare/action.yaml | 19 ++-- .../workflows/reusable-android-publish.yaml | 89 ++++++++++++++++--- .../workflows/reusable-android-release.yaml | 73 +-------------- .../workflows/reusable-android-version.yaml | 9 +- 4 files changed, 92 insertions(+), 98 deletions(-) diff --git a/.github/actions/android/prepare/action.yaml b/.github/actions/android/prepare/action.yaml index 419e2d83..3a747032 100644 --- a/.github/actions/android/prepare/action.yaml +++ b/.github/actions/android/prepare/action.yaml @@ -3,7 +3,7 @@ description: Create gradle.properties file inputs: GRADLE_VERSION: - default: '8.5' + default: "8.5" description: Gradle version required: false PROPERTIES_FILE: @@ -36,10 +36,9 @@ inputs: SONATA_PASSWORD: description: sonata password required: true - SONATYPE_REES46: - description: sonatype for rees46 - SONATYPE_PERSONACLICK: - description: sonatype for personaclick + SONATA_STAGING_PROFILE_ID: + description: sonata staging profile id + required: true OSSRH_PASSWORD: description: ossrhPassword required: true @@ -61,7 +60,7 @@ runs: uses: actions/setup-java@v4 with: java-version: 22 - distribution: 'zulu' + distribution: "zulu" - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 @@ -72,12 +71,11 @@ runs: shell: bash env: PROPERTIES_FILE: ${{ inputs.PROPERTIES_FILE }} - OSSRH_USERNAME: 'github-bot@rees46.com' + OSSRH_USERNAME: "github-bot@rees46.com" OSSRH_PASSWORD: ${{ inputs.OSSRH_PASSWORD }} SONATA_USERNAME: ${{ inputs.SONATA_USERNAME }} SONATA_PASSWORD: ${{ inputs.SONATA_PASSWORD }} - SONATYPE_REES46: ${{ inputs.SONATYPE_REES46 }} - SONATYPE_PERSONACLICK: ${{ inputs.SONATYPE_PERSONACLICK }} + SONATA_STAGING_PROFILE_ID: ${{ inputs.SONATA_STAGING_PROFILE_ID }} SIGNING_KEY_ID: ${{ inputs.SIGNING_KEY_ID }} SIGNING_PASSWORD: ${{ inputs.SIGNING_PASSWORD }} SIGNING_SECRET_KEY_RING_FILE: ${{ inputs.SIGNING_SECRET_KEY_RING_FILE }} @@ -89,8 +87,7 @@ runs: echo "ossrhPassword=$OSSRH_PASSWORD" >> $PROPERTIES_FILE echo "sonataUsername=$SONATA_USERNAME" >> $PROPERTIES_FILE echo "sonataPassword=$SONATA_PASSWORD" >> $PROPERTIES_FILE - echo "sonatype_rees46=$SONATYPE_REES46" >> $PROPERTIES_FILE - echo "sonatype_personaclick=$SONATYPE_PERSONACLICK" >> $PROPERTIES_FILE + echo "stagingProfileId=$SONATA_STAGING_PROFILE_ID" >> $PROPERTIES_FILE echo "signing_keyId=$SIGNING_KEY_ID" >> $PROPERTIES_FILE echo "signing_password=$SIGNING_PASSWORD" >> $PROPERTIES_FILE echo "signing_secretKeyRingFile=$SIGNING_SECRET_KEY_RING_FILE" >> $PROPERTIES_FILE diff --git a/.github/workflows/reusable-android-publish.yaml b/.github/workflows/reusable-android-publish.yaml index a30ae281..f6dba782 100644 --- a/.github/workflows/reusable-android-publish.yaml +++ b/.github/workflows/reusable-android-publish.yaml @@ -3,6 +3,10 @@ name: Reusable Android SDK publish to Sona on: workflow_call: inputs: + appId: + required: true + type: string + description: "App ID for committing and pushing" PROPERTIES_FILE: default: gradle.properties type: string @@ -38,8 +42,12 @@ on: type: string default: "github-bot@rees46.com" secrets: + appSecret: + required: true SONATA_USERNAME: required: true + SONATA_STAGING_PROFILE_ID: + required: true SONATA_PASSWORD: required: true OSSRH_PASSWORD: @@ -50,21 +58,23 @@ on: required: true SIGNING_KEY_FILE_AS_BASE64_STRING: required: true - SONATYPE_REES46: - required: true - SONATYPE_PERSONACLICK: - required: true jobs: run: runs-on: ubuntu-latest steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ inputs.appId }} + private-key: ${{ secrets.appSecret }} + - name: Checkout uses: actions/checkout@v4 with: - token: ${{ secrets.OSSRH_PASSWORD }} - ref: master + token: ${{ steps.app-token.outputs.token }} + branch: master - name: Prepare Android Action uses: rees46/workflow/.github/actions/android/prepare@master @@ -79,15 +89,70 @@ jobs: OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} SONATA_USERNAME: ${{ secrets.SONATA_USERNAME }} SONATA_PASSWORD: ${{ secrets.SONATA_PASSWORD }} - SONATYPE_PERSONACLICK: ${{ secrets.SONATYPE_PERSONACLICK }} - SONATYPE_REES46: ${{ secrets.SONATYPE_REES46 }} + SONATA_STAGING_PROFILE_ID: ${{ secrets.SONATA_STAGING_PROFILE_ID }} SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_KEY_FILE_AS_BASE64_STRING: ${{ secrets.SIGNING_KEY_FILE_AS_BASE64_STRING }} - - name: Debu signing + - name: Publish + run: | + ./gradlew publish + + - name: Install xmllint + run: | + sudo apt-get update + sudo apt-get install -y libxml2-utils + + - name: Debug profile id + run: | + echo ${{ secrets.SONATA_STAGING_PROFILE_ID }} + + - name: Get repos.xml + id: get_repos + run: | + REPOS=$(curl -s -u ${{ secrets.SONATA_USERNAME }}:${{ secrets.SONATA_PASSWORD }} https://s01.oss.sonatype.org/service/local/staging/profile_repositories/${{ secrets.SONATA_STAGING_PROFILE_ID }}) + echo "REPOS: $REPOS" + echo "$REPOS" > repos.xml + + - name: Extract repository IDs + id: extract_ids + run: | + repository_ids=($(xmllint --xpath '//repositoryId/text()' repos.xml)) + echo "Repository IDs: ${repository_ids[@]}" + echo "repository_ids=${repository_ids[*]}" >> $GITHUB_OUTPUT + + - name: Close stages + run: | + IFS=' ' read -r -a ids_array <<< "${{ steps.extract_ids.outputs.repository_ids }}" + + for id in "${ids_array[@]}"; do + curl -X POST \ + -u "${{ secrets.SONATA_USERNAME }}":"${{ secrets.SONATA_PASSWORD }}" \ + -H "Content-Type: application/json" \ + -d '{ + "data": { + "stagedRepositoryId": '$id' + } + }' \ + "https://s01.oss.sonatype.org/service/local/staging/profiles/${{ secrets.SONATA_STAGING_PROFILE_ID }}/finish" + done + + - name: Sleep 5 minutes + run: | + sleep 300 + + - name: Release stages run: | - ./gradlew sign --dry-run + IFS=' ' read -r -a ids_array <<< "${{ steps.extract_ids.outputs.repository_ids }}" - # - name: Publish - # run: ./gradlew publish + for id in "${ids_array[@]}"; do + curl -X POST \ + -u "${{ secrets.SONATA_USERNAME }}":"${{ secrets.SONATA_PASSWORD }}" \ + -H "Content-Type: application/json" \ + -d '{ + "data": { + "stagedRepositoryId": '$id' + } + }' \ + "https://s01.oss.sonatype.org/service/local/staging/profiles/${{ secrets.SONATA_STAGING_PROFILE_ID }}/promote" + done diff --git a/.github/workflows/reusable-android-release.yaml b/.github/workflows/reusable-android-release.yaml index 3aa83453..7c7f59ad 100644 --- a/.github/workflows/reusable-android-release.yaml +++ b/.github/workflows/reusable-android-release.yaml @@ -6,58 +6,8 @@ on: appId: required: true type: string - description: 'App ID for committing and pushing' - PROPERTIES_FILE: - default: gradle.properties - type: string - description: Relative file path for putting in secrets - required: false - SIGNING_SECRET_KEY_RING_FILE: - default: com.rees46.key.gpg - type: string - description: Location and name for signature file - required: false - SIGNING_SECRET_KEY_RING_FILE_LOCATION: - type: string - description: Location and name for signature file - required: true - GRADLE_VERSION: - type: number - required: false - VARIANT_NAME: - description: REES46 or PersonaClick - type: string - required: true - URL: - description: GitHub repo URL - type: string - required: true - MAVEN_REPOSITORY_URL: - description: Maven repository publish to - type: string - required: true - OSSRH_USERNAME: - required: false - type: string - default: 'github-bot@rees46.com' - + description: "App ID for committing and pushing" secrets: - SONATA_USERNAME: - required: true - SONATA_PASSWORD: - required: true - SONATYPE_REES46: - required: true - SONATYPE_PERSONACLICK: - required: true - OSSRH_PASSWORD: - required: true - SIGNING_KEY_ID: - required: true - SIGNING_PASSWORD: - required: true - SIGNING_KEY_FILE_AS_BASE64_STRING: - required: true appSecret: required: true @@ -76,26 +26,7 @@ jobs: uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} - ref: master - - - name: Prepare Android Action - uses: rees46/workflow/.github/actions/android/prepare@master - with: - PROPERTIES_FILE: ${{ inputs.PROPERTIES_FILE }} - SIGNING_SECRET_KEY_RING_FILE: ${{ inputs.SIGNING_SECRET_KEY_RING_FILE }} - SIGNING_SECRET_KEY_RING_FILE_LOCATION: ${{ inputs.SIGNING_SECRET_KEY_RING_FILE_LOCATION }} - VARIANT_NAME: ${{ inputs.VARIANT_NAME }} - URL: ${{ inputs.URL }} - MAVEN_REPOSITORY_URL: ${{ inputs.MAVEN_REPOSITORY_URL }} - OSSRH_USERNAME: ${{ inputs.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SONATA_USERNAME: ${{ secrets.SONATA_USERNAME }} - SONATA_PASSWORD: ${{ secrets.SONATA_PASSWORD }} - SONATYPE_PERSONACLICK: ${{ secrets.SONATYPE_PERSONACLICK }} - SONATYPE_REES46: ${{ secrets.SONATYPE_REES46 }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY_FILE_AS_BASE64_STRING: ${{ secrets.SIGNING_KEY_FILE_AS_BASE64_STRING }} + branch: master - name: Retrieve version id: versionName diff --git a/.github/workflows/reusable-android-version.yaml b/.github/workflows/reusable-android-version.yaml index ccaca8b4..7f802259 100644 --- a/.github/workflows/reusable-android-version.yaml +++ b/.github/workflows/reusable-android-version.yaml @@ -24,7 +24,7 @@ on: appId: required: true type: string - description: 'App ID for committing and pushing' + description: "App ID for committing and pushing" VARIANT_NAME: description: REES46 or PersonaClick type: string @@ -40,7 +40,7 @@ on: OSSRH_USERNAME: required: false type: string - default: 'github-bot@rees46.com' + default: "github-bot@rees46.com" secrets: SONATA_USERNAME: required: true @@ -78,6 +78,7 @@ jobs: uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} + branch: master - name: Prepare Android Action uses: rees46/workflow/.github/actions/android/prepare@master @@ -118,5 +119,5 @@ jobs: with: repo: ${{ github.repository }} branch: master - commit_message: 'chore(common): version bump to ${{ steps.versionName.outputs.versionName }}' - file_pattern: 'personalization-sdk' + commit_message: "chore(common): version bump to ${{ steps.versionName.outputs.versionName }}" + file_pattern: "personalization-sdk" From 4d8f956ba18740f0e13373e2a00b4ab058b916a6 Mon Sep 17 00:00:00 2001 From: kirill ivanov Date: Tue, 1 Apr 2025 21:59:36 +0300 Subject: [PATCH 3/3] style(github): format --- .github/actions/android/prepare/action.yaml | 6 +++--- .github/workflows/reusable-android-publish.yaml | 4 ++-- .github/workflows/reusable-android-release.yaml | 2 +- .../workflows/reusable-android-synchronization.yaml | 2 +- .github/workflows/reusable-android-version.yaml | 6 +++--- .github/workflows/reusable-ios-synchronization.yaml | 6 +++--- .github/workflows/reusable-ios-testflight-publish.yaml | 10 +++++----- .github/workflows/reusable-multiplatform-bump.yaml | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/actions/android/prepare/action.yaml b/.github/actions/android/prepare/action.yaml index 3a747032..3a25cec9 100644 --- a/.github/actions/android/prepare/action.yaml +++ b/.github/actions/android/prepare/action.yaml @@ -3,7 +3,7 @@ description: Create gradle.properties file inputs: GRADLE_VERSION: - default: "8.5" + default: '8.5' description: Gradle version required: false PROPERTIES_FILE: @@ -60,7 +60,7 @@ runs: uses: actions/setup-java@v4 with: java-version: 22 - distribution: "zulu" + distribution: 'zulu' - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 @@ -71,7 +71,7 @@ runs: shell: bash env: PROPERTIES_FILE: ${{ inputs.PROPERTIES_FILE }} - OSSRH_USERNAME: "github-bot@rees46.com" + OSSRH_USERNAME: 'github-bot@rees46.com' OSSRH_PASSWORD: ${{ inputs.OSSRH_PASSWORD }} SONATA_USERNAME: ${{ inputs.SONATA_USERNAME }} SONATA_PASSWORD: ${{ inputs.SONATA_PASSWORD }} diff --git a/.github/workflows/reusable-android-publish.yaml b/.github/workflows/reusable-android-publish.yaml index f6dba782..c0f99e00 100644 --- a/.github/workflows/reusable-android-publish.yaml +++ b/.github/workflows/reusable-android-publish.yaml @@ -6,7 +6,7 @@ on: appId: required: true type: string - description: "App ID for committing and pushing" + description: 'App ID for committing and pushing' PROPERTIES_FILE: default: gradle.properties type: string @@ -40,7 +40,7 @@ on: OSSRH_USERNAME: required: false type: string - default: "github-bot@rees46.com" + default: 'github-bot@rees46.com' secrets: appSecret: required: true diff --git a/.github/workflows/reusable-android-release.yaml b/.github/workflows/reusable-android-release.yaml index 7c7f59ad..5c21a530 100644 --- a/.github/workflows/reusable-android-release.yaml +++ b/.github/workflows/reusable-android-release.yaml @@ -6,7 +6,7 @@ on: appId: required: true type: string - description: "App ID for committing and pushing" + description: 'App ID for committing and pushing' secrets: appSecret: required: true diff --git a/.github/workflows/reusable-android-synchronization.yaml b/.github/workflows/reusable-android-synchronization.yaml index d40e690a..e31ab271 100644 --- a/.github/workflows/reusable-android-synchronization.yaml +++ b/.github/workflows/reusable-android-synchronization.yaml @@ -25,7 +25,7 @@ jobs: - name: Get current version from source working-directory: source env: - FILE_PATH: "version.properties" + FILE_PATH: 'version.properties' id: version_source run: | current_version=$(awk -F"=" '/VERSION_NAME/ {print $2}' "$FILE_PATH") diff --git a/.github/workflows/reusable-android-version.yaml b/.github/workflows/reusable-android-version.yaml index 14da8496..13b38128 100644 --- a/.github/workflows/reusable-android-version.yaml +++ b/.github/workflows/reusable-android-version.yaml @@ -6,7 +6,7 @@ on: appId: required: true type: string - description: "App ID for committing and pushing" + description: 'App ID for committing and pushing' secrets: appSecret: required: true @@ -50,5 +50,5 @@ jobs: with: repo: ${{ github.repository }} branch: master - commit_message: "chore(common): version bump to ${{ steps.versionName.outputs.versionName }}" - file_pattern: "personalization-sdk" + commit_message: 'chore(common): version bump to ${{ steps.versionName.outputs.versionName }}' + file_pattern: 'personalization-sdk' diff --git a/.github/workflows/reusable-ios-synchronization.yaml b/.github/workflows/reusable-ios-synchronization.yaml index 048f7f4c..a9065dc1 100644 --- a/.github/workflows/reusable-ios-synchronization.yaml +++ b/.github/workflows/reusable-ios-synchronization.yaml @@ -1,7 +1,7 @@ name: Sync iOS Repositories env: - WORKFLOW_REPO: "rees46/workflow" + WORKFLOW_REPO: 'rees46/workflow' on: workflow_call: @@ -12,11 +12,11 @@ on: targetRepository: type: string required: true - default: "Target repository" + default: 'Target repository' versionFilePath: type: string required: true - default: "version.properties" + default: 'version.properties' jobs: run: diff --git a/.github/workflows/reusable-ios-testflight-publish.yaml b/.github/workflows/reusable-ios-testflight-publish.yaml index a480917d..27998992 100644 --- a/.github/workflows/reusable-ios-testflight-publish.yaml +++ b/.github/workflows/reusable-ios-testflight-publish.yaml @@ -1,10 +1,10 @@ name: Reusable iOS TestFlight Publish env: - WORKFLOW_REPO: "rees46/workflow" - ARCHIVE_EXPORT_PATH: "./build/exported-app" - EXPORT_OPTIONS_PLIST_PATH: "./ExportOptions.plist" - PROPERTIES_FILE: "version.properties" + WORKFLOW_REPO: 'rees46/workflow' + ARCHIVE_EXPORT_PATH: './build/exported-app' + EXPORT_OPTIONS_PLIST_PATH: './ExportOptions.plist' + PROPERTIES_FILE: 'version.properties' on: workflow_call: @@ -144,7 +144,7 @@ jobs: - name: Upload to TestFlight uses: Apple-Actions/upload-testflight-build@master with: - app-path: "${{ env.ARCHIVE_EXPORT_PATH }}/${{ inputs.scheme }}.ipa" + app-path: '${{ env.ARCHIVE_EXPORT_PATH }}/${{ inputs.scheme }}.ipa' issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} api-key-id: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} api-private-key: ${{ secrets.APP_STORE_CONNECT_API_KEY }} diff --git a/.github/workflows/reusable-multiplatform-bump.yaml b/.github/workflows/reusable-multiplatform-bump.yaml index 758fa33e..8f894393 100644 --- a/.github/workflows/reusable-multiplatform-bump.yaml +++ b/.github/workflows/reusable-multiplatform-bump.yaml @@ -1,8 +1,8 @@ name: Reusable multiplatform bump env: - WORKFLOW_REPO: "rees46/workflow" - PROPERTIES_FILE: "version.properties" + WORKFLOW_REPO: 'rees46/workflow' + PROPERTIES_FILE: 'version.properties' on: workflow_call: @@ -58,5 +58,5 @@ jobs: with: repo: ${{ github.repository }} branch: master - commit_message: "chore: bump version to ${{ steps.versionName.outputs.versionName }}" + commit_message: 'chore: bump version to ${{ steps.versionName.outputs.versionName }}' file_pattern: ${{ env.PROPERTIES_FILE }}