-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (87 loc) · 3.51 KB
/
Copy pathandroid.yml
File metadata and controls
91 lines (87 loc) · 3.51 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Android CI
on: [push,pull_request]
jobs:
build:
name: Android Compilation Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: 17
- name: Make Gradle executable
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Run Unit Tests
run: ./gradlew testDebugUnitTest
- name: Generate Local Properties file
env:
GPG_SIGN_KEY: ${{ secrets.GPG_SIGNING_KEY }}
run: echo $GPG_SIGN_KEY | base64 --decode > ./local.properties
- name: Local publishing test to ensure working
run: ./gradlew clean build publishReleasePublicationToMavenLocal
env:
GPG_SIGN_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
mavenCentral:
name: Release to Maven Central
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GH_PAT }}
- name: set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: 17
- name: Make Gradle executable
run: chmod +x gradlew
- name: Generate Local Properties file
env:
GPG_SIGN_KEY: ${{ secrets.GPG_SIGNING_KEY }}
run: echo $GPG_SIGN_KEY | base64 --decode > ./local.properties
- name: Generate artifact, publish release and upload to Maven Central and GitHub Packages
run: ./gradlew clean build publish
env:
MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRALPASSWORD }}
MAVENCENTRAL_USER: ${{ secrets.MAVENCENTRALUSER }}
GPG_SIGN_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
- name: (Temp) Curl to stage the release # Temporary until Gradle maven-publish supports Maven Central
run: |
curl -i -X 'POST' 'https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.itachi1706?publishing_type=user_managed' -H 'accept: */*' -H 'Authorization: Bearer ${{ secrets.MAVENCENTRALAUTHORIZATION }}' -d ''
echo "Completed. Please go to https://central.sonatype.com/publishing/deployments to verify the release"
- name: Move Library AAR file to main folder
run: mv ./helperlib/build/outputs/aar/helperlib-release.aar ./helperlib-release.aar
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GH Actions
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
generate_release_notes: true
draft: false
prerelease: false
files: helperlib-release.aar
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: master
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md
- name: Finish Up
run: echo Upload successful. Maintainers can proceed onto https://s01.oss.sonatype.org to release the artifacts when capable