From bdb101bbe92b13a23134cd52f6c7cf4ca70923e1 Mon Sep 17 00:00:00 2001 From: Luke Walton Date: Fri, 18 Oct 2024 16:20:07 +0100 Subject: [PATCH] ci: Add release-please (#3) ci: Add release / publish script --- .github/CODEOWNERS | 1 + .github/workflows/on-main.yml | 17 ++++++++ .github/workflows/on-release.yml | 32 +++++++++++++++ .release-please-manifest.json | 3 ++ README.md | 5 ++- components/build.gradle | 2 + release-please-config.json | 67 ++++++++++++++++++++++++++++++++ 7 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/on-main.yml create mode 100644 .github/workflows/on-release.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ff951cf --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @benken @thelukewalton \ No newline at end of file diff --git a/.github/workflows/on-main.yml b/.github/workflows/on-main.yml new file mode 100644 index 0000000..2a3a0e6 --- /dev/null +++ b/.github/workflows/on-main.yml @@ -0,0 +1,17 @@ +name: CI - On Main +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml new file mode 100644 index 0000000..3be11b4 --- /dev/null +++ b/.github/workflows/on-release.yml @@ -0,0 +1,32 @@ +name: CI - On Release +on: + workflow_dispatch: + release: + types: [released] + +jobs: + Artifact: + runs-on: ubuntu-latest + permissions: + id-token: write + environment: artifactory + env: + username: ${{ secrets.ARTIFACTORY_USERNAME }} + password: ${{ secrets.ARTIFACTORY_PASSWORD }} + zds-android-maven: ${{ secrets.ZDS_ANDROID_MAVEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Add environment variables + run: | + echo "username=${{secrets.ARTIFACTORY_USERNAME}}" >> gradle.properties + echo "password=${{secrets.ARTIFACTORY_PASSWORD}}" >> gradle.properties + echo "zds-android-maven=${{secrets.ZDS_ANDROID_MAVEN}}" >> gradle.properties + + - name: Publish + run: gradle publish -P publish=rel diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..fea3454 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.0" +} \ No newline at end of file diff --git a/README.md b/README.md index 7ddf562..a29cb58 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,16 @@ dependencyResolutionManagement { 2. Add dependency to **app-level** `build.gradle` + + ``` dependencies { - ... implementation 'com.zebra:zds:1.0.0' } ``` + + Once this is added, your IDE should 3. For the components to work and receive the correct theme values, we must add the theme n `AndroidManifest.xml`. Be sure to remove other themes which could override this and prevent the components from working. diff --git a/components/build.gradle b/components/build.gradle index 453188e..17de3c9 100644 --- a/components/build.gradle +++ b/components/build.gradle @@ -43,7 +43,9 @@ publishing { release(MavenPublication) { groupId = 'com.zebra' artifactId = 'zds' + // x-release-please-start-version version = '1.0.0' + // x-release-please-end afterEvaluate { from components.release diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..3e94143 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": { + "release-type": "simple" + } + }, + "include-component-in-tag": false, + "extra-files": [ + "README.md", + "components/build.gradle" + ], + "changelog-sections": [ + { + "type": "feat", + "section": "โœจ New Features" + }, + { + "type": "fix", + "section": "๐Ÿชฒ Bug Fixes" + }, + { + "type": "revert", + "section": "๐Ÿ‘€ Reverts" + }, + { + "type": "docs", + "section": "๐Ÿ“ˆ Documentation" + }, + { + "type": "deps", + "section": "โ›“๏ธ Dependencies" + }, + { + "type": "test", + "section": "๐Ÿงช Tests" + }, + { + "type": "chore", + "section": "๐Ÿงน Miscellaneous Chores" + }, + { + "type": "perf", + "section": "Performance Improvements", + "hidden": true + }, + { + "type": "refactor", + "section": "Code Refactoring", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "build", + "section": "Build System", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ] +} \ No newline at end of file