-
Notifications
You must be signed in to change notification settings - Fork 123
110 lines (97 loc) · 3.97 KB
/
release.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
jobs:
release:
if: github.repository == 'urbanairship/android-library'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Get the release notes
id: get_release_notes
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
delimiter="$(openssl rand -hex 8)"
{
echo "NOTES<<${delimiter}"
awk "/## Version $VERSION/{flag=1;next}/## Version/{flag=0}flag" CHANGELOG.md
echo ${delimiter}
} >> $GITHUB_OUTPUT
- name: Setup Java Version
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: Verify Version
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
if [[ $(./gradlew -q getVersion) = $VERSION ]]; then exit 0 ; else exit 1; fi
- name: Build
run: ./gradlew assembleRelease packageDocs --stacktrace
- name: Publish to Maven Central
env:
SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }}
SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.MAVEN_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: >-
./gradlew
urbanairship-core:publishProductionPublicationToSonatypeRepository
urbanairship-layout:publishProductionPublicationToSonatypeRepository
urbanairship-automation:publishProductionPublicationToSonatypeRepository
urbanairship-automation-compose:publishProductionPublicationToSonatypeRepository
urbanairship-message-center:publishProductionPublicationToSonatypeRepository
urbanairship-live-update:publishProductionPublicationToSonatypeRepository
urbanairship-fcm:publishProductionPublicationToSonatypeRepository
urbanairship-adm:publishProductionPublicationToSonatypeRepository
urbanairship-hms:publishProductionPublicationToSonatypeRepository
urbanairship-preference-center:publishProductionPublicationToSonatypeRepository
urbanairship-feature-flag:publishProductionPublicationToSonatypeRepository
--stacktrace
--max-workers 1
closeAndReleaseSonatypeStagingRepository
- name: Github Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
body: ${{ steps.get_release_notes.outputs.NOTES }}
draft: false
prerelease: false
- name: Upload java doc assets
uses: actions/upload-artifact@v3
with:
name: packaged-docs-${{ steps.get_version.outputs.VERSION }}
retention-days: 1
path: |
build/docs/${{ steps.get_version.outputs.VERSION }}.tar.gz
build/docs/${{ steps.get_version.outputs.VERSION }}-kdoc.tar.gz
# The publish-docs workflow will build the docs if we
# somehow fail to upload them in this step.
if-no-files-found: warn
release-docs:
if: github.repository == 'urbanairship/android-library'
needs: release
uses: ./.github/workflows/publish-docs.yml
with:
version: ${{ needs.release.outputs.version }}
secrets:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}