-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (64 loc) · 2.46 KB
/
library_release.yaml
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
name: Build and Publish Release Artifacts
on:
push:
tags:
- 'v*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
buildRelease:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Extract version from tag
uses: damienaicheh/[email protected]
- name: Set version name variable
run: |
# Set new version name from tag
version_name=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
# Set environment variable for later use
echo "VERSION_NAME=$version_name" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Save GPG Keys
env:
GPG_FILE: ${{ secrets.GPG_FILE }}
run: echo $GPG_FILE | base64 -d > sonatype-secret-keys.gpg
- name: Add Gradle Credentials
env:
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
./gradlew addCredentials --key sonatypeUsername --value $SONATYPE_USERNAME
./gradlew addCredentials --key sonatypePassword --value $SONATYPE_PASSWORD
./gradlew addCredentials --key sonatypeKeyPassword --value $GPG_KEY_PASSWORD
- name: Create gradle.properties
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "signing.keyId=$GPG_KEY_ID" >> gradle.properties
echo "signing.secretKeyRingFile=$(pwd)/sonatype-secret-keys.gpg" >> gradle.properties
- name: Build and Publish Release Artifacts
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew clean build publishReleasePublicationToMavenRepository
- name: Create a Release in GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "MqttLibrary/build/outputs/aar/*.aar"
tag: v${{ env.VERSION_NAME }}
commit: ${{ github.sha }}
generateReleaseNotes: true
draft: false