Merge pull request #61 from RedMadRobot/feature/update-dependencies #193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
# Release tag format is [library-name]-v[version] | |
# Examples: fragment-ktx-v1.3.5-0, gears-compose-v1.1.1, resultflow-v0.1.0 | |
tags: ['*-v*'] | |
pull_request: | |
branches: [main] | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Run Check | |
run: ./gradlew check -xlint | |
- name: Run Detekt | |
run: ./gradlew detektAll detektReleaseAll | |
publish: | |
name: Publish | |
needs: check | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Get module name from tag | |
id: parse-tag | |
run: | | |
tag=${GITHUB_REF#refs/tags/} | |
module=$(./scripts/get-module-name.sh "$tag") | |
module_path=${module#:} | |
module_path=${module_path//://} | |
echo "module=$module" >> "$GITHUB_OUTPUT" | |
echo "module_path=$module_path" >> "$GITHUB_OUTPUT" | |
echo "name=${tag/-v/ }" >> "$GITHUB_OUTPUT" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Run Publish | |
run: ./gradlew ${{ steps.parse-tag.outputs.module }}:publish | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ github.actor }} | |
ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract release notes | |
uses: ffurrer2/extract-release-notes@v2 | |
with: | |
changelog_file: ${{ steps.parse-tag.outputs.module_path }}/CHANGELOG.md | |
release_notes_file: RELEASE_NOTES.md | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ steps.parse-tag.outputs.name }} | |
body_path: RELEASE_NOTES.md |