Skip to content

Commit

Permalink
add cd
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamgyf committed Nov 5, 2022
1 parent bfc6fbe commit cade89d
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 2 deletions.
144 changes: 144 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: CD

on:
release:
types: [ published ]

jobs:
Test_For_FastInflate:
runs-on: ubuntu-latest
steps:
- name: Clone parent project AndroidLibraries
run: git clone https://github.com/dreamgyf/AndroidLibraries.git

- name: Clone project FastInflate
uses: actions/checkout@v3
with:
path: 'AndroidLibraries/FastInflate'

- name: Fetch key file
uses: actions/checkout@v3
with:
token: ${{ secrets.TOKEN_FOR_GITHUB }}
repository: 'dreamgyf/key'
path: 'key'

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Prepare for Gradle
working-directory: 'AndroidLibraries/FastInflate'
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
run: |
mkdir -p ~/.gradle/
echo ${GRADLE_PROPERTIES} > ~/.gradle/gradle.properties
chmod +x gradlew
- name: Publish FastInflatePlugin to local maven
working-directory: 'AndroidLibraries/FastInflate'
run: |
./gradlew :FastInflatePlugin:assemble
./gradlew :FastInflatePlugin:publishToMavenLocal
- name: Publish FastInflate to local maven
working-directory: 'AndroidLibraries/FastInflate'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_PATH: ${{ github.workspace }}/key/dreamgyf_6E5F7FAF_secret.gpg
run: |
./gradlew :FastInflate:assemble
./gradlew :FastInflate:publishToMavenLocal
- name: Do Unit Test for :Sample:app
working-directory: 'AndroidLibraries/FastInflate/Sample'
run: |
chmod +x gradlew
./gradlew :app:test
- name: Unit Test Report
uses: asadmansr/android-test-report-action@v1.2.0
if: ${{ always() }}

Publish_FastInflatePlugin:
runs-on: ubuntu-latest
needs: Test_For_FastInflate
steps:
- name: Clone parent project AndroidLibraries
run: git clone https://github.com/dreamgyf/AndroidLibraries.git

- name: Clone project FastInflate
uses: actions/checkout@v3
with:
path: 'AndroidLibraries/FastInflate'

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Prepare for Gradle
working-directory: 'AndroidLibraries/FastInflate'
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
run: |
mkdir -p ~/.gradle/
echo ${GRADLE_PROPERTIES} > ~/.gradle/gradle.properties
chmod +x gradlew
- name: Publish FastInflatePlugin
working-directory: 'AndroidLibraries/FastInflate'
run: |
./gradlew :FastInflatePlugin:assemble
./gradlew :FastInflatePlugin:publishPlugins
Publish_FastInflate:
runs-on: ubuntu-latest
needs: Test_For_FastInflate
steps:
- name: Clone parent project AndroidLibraries
run: git clone https://github.com/dreamgyf/AndroidLibraries.git

- name: Clone project FastInflate
uses: actions/checkout@v3
with:
path: 'AndroidLibraries/FastInflate'

- name: Fetch key file
uses: actions/checkout@v3
with:
token: ${{ secrets.TOKEN_FOR_GITHUB }}
repository: 'dreamgyf/key'
path: 'key'

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Prepare for Gradle
working-directory: 'AndroidLibraries/FastInflate'
run: chmod +x gradlew

- name: Publish FastInflate
working-directory: 'AndroidLibraries/FastInflate'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_PATH: ${{ github.workspace }}/key/dreamgyf_6E5F7FAF_secret.gpg
run: |
./gradlew :FastInflate:assemble
./gradlew :FastInflate:publish
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:

steps:
- name: Clone parent project AndroidLibraries
run: |
git clone https://github.com/dreamgyf/AndroidLibraries.git
run: git clone https://github.com/dreamgyf/AndroidLibraries.git

- name: Clone project FastInflate
uses: actions/checkout@v3
Expand Down

0 comments on commit cade89d

Please sign in to comment.