Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into 3.0_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotchen0 committed Apr 10, 2024
2 parents 101f67c + 75fb3f1 commit fb60274
Show file tree
Hide file tree
Showing 18 changed files with 231 additions and 76 deletions.
134 changes: 134 additions & 0 deletions .github/workflows/project_artifact_snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: '[project] artifact snapshot'

on:
workflow_dispatch:
inputs:
git_ref:
description: 'Git Ref'
type: string
required: true
version_name:
description: 'Version name'
type: string
required: true
registry_choice:
description: 'Registry choice'
type: choice
required: true
default: 'Both'
options:
- Default
- Github
- Both
is_release_for_android:
description: 'Release for Android'
type: boolean
default: true
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
context_in_lowercase:
if: github.event.inputs.is_release_for_android == 'true'
runs-on: ubuntu-latest
outputs:
repository_owner: ${{ steps.get_owner.outputs.lowercase }}
steps:
- name: Get repo owner(in lowercase)
id: get_owner
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.repository_owner }}

android_release:
if: github.event.inputs.is_release_for_android == 'true'
needs: context_in_lowercase
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Release]
include:
- build_type: Release
artifact_id: hippy-snapshot
container:
image: ghcr.io/${{ needs.context_in_lowercase.outputs.repository_owner }}/android-release:latest
steps:
- name: Checkout (${{ github.event.inputs.git_ref }})
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.git_ref }}
lfs: true
- name: ${{ matrix.build_type }} build
env:
SIGNING_KEY_ID: ${{ secrets.ANDROID_SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
SIGNING_SECRET_KEY: ${{ secrets.ANDROID_SIGNING_SECRET_KEY }}
run: |
./gradlew assemble${{ matrix.build_type }} -PVERSION_NAME=${{ github.event.inputs.version_name }} -PPUBLISH_ARTIFACT_ID=${{ matrix.artifact_id }} -PINCLUDE_ABI_X86=true -PINCLUDE_ABI_X86_64=true
./gradlew signMavenAarPublication
- name: Pre Archive artifacts
shell: bash
run: |
pip3 install -U cos-python-sdk-v5
- name: Archive artifacts
working-directory: ./framework/android/build
shell: python3 {0}
run: |
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
from urllib.parse import urlencode
import os
import tempfile
import zipfile
artifacts = [("outputs/aar/android-sdk.aar", "hippy/android/${{ matrix.artifact_id }}/${{ github.event.inputs.version_name }}/android-sdk.aar")]
for path, dirs, files in os.walk("intermediates/merged_native_libs/%s/out/lib" % "${{ matrix.build_type }}".lower()):
if files:
with zipfile.ZipFile(tempfile.mkstemp()[1], "w", zipfile.ZIP_DEFLATED) as zip_file:
for file in files:
zip_file.write(os.path.join(path, file), file)
artifacts.append((zip_file.filename, "hippy/android/${{ matrix.artifact_id }}/${{ github.event.inputs.version_name }}/symbols/%s.zip" % os.path.basename(path)))
metadata = {}
metadata["ci-name"] = "Github Action"
metadata["ci-id"] = "${{ github.run_id }}"
metadata["ci-url"] = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
metadata["artifact-author"] = "${{ github.event.sender.login }}"
metadata["git-ref"] = "${{ github.event.inputs.git_ref }}"
config = CosConfig(Region="${{ secrets.COS_REGION }}", SecretId="${{ secrets.TC_SECRET_ID }}", SecretKey="${{ secrets.TC_SECRET_KEY }}")
client = CosS3Client(config)
for artifact in artifacts:
print("Uploading %s" % artifact[0])
response = client.upload_file(
Bucket="${{ secrets.COS_BUCKET_ARTIFACTS_STORE }}",
Key=artifact[1],
LocalFilePath=artifact[0],
Metadata={"x-cos-tagging": urlencode(metadata)}
)
print("Archived %s" % artifact[1])
- name: Publish to Github Packages
if: github.event.inputs.registry_choice == 'Both' || github.event.inputs.registry_choice == 'Github'
env:
SIGNING_KEY_ID: ${{ secrets.ANDROID_SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
SIGNING_SECRET_KEY: ${{ secrets.ANDROID_SIGNING_SECRET_KEY }}
MAVEN_USERNAME: ${{ secrets.GITHUB_ACTOR }}
MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
MAVEN_URL: https://maven.pkg.github.com/${{ github.repository }}
run: |
./gradlew publish -PVERSION_NAME=${{ github.event.inputs.version_name }} -PPUBLISH_ARTIFACT_ID=${{ matrix.artifact_id }} -PINCLUDE_ABI_X86=true -PINCLUDE_ABI_X86_64=true
- name: Publish to OSSRH
if: github.event.inputs.registry_choice == 'Both' || github.event.inputs.registry_choice == 'Default'
env:
SIGNING_KEY_ID: ${{ secrets.ANDROID_SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
SIGNING_SECRET_KEY: ${{ secrets.ANDROID_SIGNING_SECRET_KEY }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
./gradlew publish -PVERSION_NAME=${{ github.event.inputs.version_name }} -PPUBLISH_ARTIFACT_ID=${{ matrix.artifact_id }} -PINCLUDE_ABI_X86=true -PINCLUDE_ABI_X86_64=true
3 changes: 1 addition & 2 deletions docs/development/android-3.0-integration-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
下面引用Hippy最新版本号可在上述链接中查询

```java
// implementation 'com.tencent.hippy:hippy-debug:3.2.0-beta'
implementation 'com.tencent.hippy:hippy-release:3.2.0-beta'
implementation 'com.tencent.hippy:hippy-snapshot:3.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fb60274

Please sign in to comment.