-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (52 loc) · 1.54 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: CI
on:
push:
branches: [main]
# Release tag format is [module-name]-v[androidx-version]-[ktx-version]
# For example: fragment-ktx-v1.3.5-0
tags: ['*-ktx-v*-[0-9]+']
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 KTX
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: get-module-name
run: |
tag=${GITHUB_REF#refs/tags/}
echo "result=${tag/-v*}" >> "$GITHUB_OUTPUT"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run Publish
run: ./gradlew :ktx:${{ steps.get-module-name.outputs.result }}:publish
env:
ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ github.actor }}
ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }}