From e8df118143c904e17d8b95c95f86ae62a920ed00 Mon Sep 17 00:00:00 2001 From: vahidlazio Date: Wed, 6 Sep 2023 02:44:44 -0400 Subject: [PATCH] feat: create release please manifest and config file and ci workflow (#59) --- .github/workflows/release-please.yaml | 73 +++++++++++++++++++++++++++ .github/workflows/release.yaml | 54 -------------------- .release-please-manifest.json | 0 release-please-config.json | 66 ++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/release-please.yaml delete mode 100644 .github/workflows/release.yaml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 00000000..c6c57d4b --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,73 @@ +on: + push: + branches: + - main + +name: Run Release Please +jobs: + release-please: + runs-on: ubuntu-latest + + # Release-please creates a PR that tracks all changes + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: simple + command: manifest + token: ${{secrets.TOKEN_PUBLISH}} + default-branch: main + + - name: Dump Release Please Output + env: + RELEASE_PLEASE_OUTPUT: ${{ toJson(steps.release.outputs) }} + run: | + echo "$RELEASE_PLEASE_OUTPUT" + + # Outputs are namespaced by package when using a manifest in Release Please + outputs: + release_created: ${{ steps.release.outputs['Provider--release_created'] }} + # Version doesn't include `v` as a prefix. This is undocumented + version: ${{ steps.release.outputs['Provider--version'] }} + upload_url: ${{ steps.release.outputs['Provider--upload_url'] }} + + kotlin-release: + needs: release-please + runs-on: ubuntu-latest + if: ${{ needs.release-please.outputs.release_created }} + steps: + # The logic below handles the github release: + - name: Cache Gradle and wrapper + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: 11 + + - name: Grant Permission for Gradlew to Execute + run: chmod +x gradlew + + - name: Build AAR โš™๏ธ๐Ÿ›  + env: + OF_KOTLIN_RELEASE_VERSION: ${{ needs.release-please.outputs.version }} + run: bash ./gradlew :provider:assemble + + - name: Upload Confidence Provider SDK AAR ๐Ÿ—ณ + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_PUBLISH }} + with: + upload_url: ${{ needs.release-please.outputs.upload_url }} + asset_path: Provider/build/outputs/aar/Provider-release.aar + asset_name: provider-sdk.aar + asset_content_type: application/aar \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 8a0ec44f..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Release -on: - push: - tags: - - 'v*' - -jobs: - publish: - name: Release Spotify Confidence Provider - runs-on: ubuntu-latest - - steps: - - name: Cache Gradle and wrapper - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- - - uses: actions/checkout@v1 - - - name: Set up JDK 12 - uses: actions/setup-java@v1 - with: - java-version: 12 - - - name: Grant Permission for Gradlew to Execute - run: chmod +x gradlew - - - name: Build AAR โš™๏ธ๐Ÿ›  - run: bash ./gradlew :provider:assemble - - - name: Create Release โœ… - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.TOKEN_PUBLISH }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: true - prerelease: false - - - name: Upload Confidence Provider AAR ๐Ÿ—ณ - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.TOKEN_PUBLISH }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: Provider/build/outputs/aar/Provider-release.aar - asset_name: provider-release.aar - asset_content_type: application/aar \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..e69de29b diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..55ef86fb --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "bootstrap-sha": "fe4d0c5e5553cf34a4089e52de5324370bb933dd", + "packages": { + "Provider": { + "release-type": "simple", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "versioning": "default" + } + }, + "changelog-sections": [ + { + "type": "fix", + "section": "๐Ÿ› Bug Fixes" + }, + { + "type": "feat", + "section": "โœจ New Features" + }, + { + "type": "chore", + "section": "๐Ÿงน Chore" + }, + { + "type": "docs", + "section": "๐Ÿ“š Documentation" + }, + { + "type": "perf", + "section": "๐Ÿš€ Performance" + }, + { + "type": "build", + "hidden": true, + "section": "๐Ÿ› ๏ธ Build" + }, + { + "type": "deps", + "section": "๐Ÿ“ฆ Dependencies" + }, + { + "type": "ci", + "hidden": true, + "section": "๐Ÿšฆ CI" + }, + { + "type": "refactor", + "section": "๐Ÿ”„ Refactoring" + }, + { + "type": "revert", + "section": "๐Ÿ”™ Reverts" + }, + { + "type": "style", + "hidden": true, + "section": "๐ŸŽจ Styling" + }, + { + "type": "test", + "hidden": true, + "section": "๐Ÿงช Tests" + } + ], + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}