Skip to content

Commit 433bf05

Browse files
committed
Release scripts updated
1 parent decb68e commit 433bf05

File tree

12 files changed

+1518
-9
lines changed

12 files changed

+1518
-9
lines changed

.github/workflows/deploy-all.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to Nexus
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
workflow_dispatch:
7+
jobs:
8+
generateReadme:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: master
14+
fetch-depth: 0
15+
- shell: bash
16+
run: |
17+
git config user.email [email protected]
18+
git config user.name "Github Action"
19+
VERSION=`git describe --tags --abbrev=0`
20+
VERSION=`./moustache/split.sh $VERSION`
21+
rm -f ./README.md
22+
VERSION=$VERSION ./moustache/mo ./moustache/README.mo > ./README.md
23+
git add .
24+
git commit -m "Update readme to version=$VERSION"
25+
git push
26+
deployAarsToNexus:
27+
needs: generateReadme
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
with:
32+
ref: master
33+
fetch-depth: 0
34+
- shell: bash
35+
env:
36+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
37+
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
38+
OSSR_USERNAME: ${{ secrets.OSSR_USERNAME }}
39+
OSSR_PASSWORD: ${{ secrets.OSSR_PASSWORD }}
40+
SONATYPE_STATING_PROFILE_ID: ${{ secrets.SONATYPE_STATING_PROFILE_ID }}
41+
run: |
42+
echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc
43+
gpg -d --passphrase "${{ secrets.GPG_FILE_PSWD }}" --batch sec.gpg.asc > sec.gpg
44+
bundle exec fastlane deployNexus

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"

fastlane/Fastfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This file contains the fastlane.tools configuration
2+
# You can find the documentation at https://docs.fastlane.tools
3+
#
4+
# For a list of all available actions, check out
5+
#
6+
# https://docs.fastlane.tools/actions
7+
#
8+
# For a list of all available plugins, check out
9+
#
10+
# https://docs.fastlane.tools/plugins/available-plugins
11+
#
12+
13+
# Uncomment the line if you want fastlane to automatically update itself
14+
# update_fastlane
15+
16+
default_platform(:android)
17+
18+
platform :android do
19+
20+
desc "Runs all the tests"
21+
lane :test do
22+
gradle(task: "test")
23+
end
24+
25+
desc "Deploy libraries to Nexus."
26+
lane :deployNexus do
27+
gradle(task: "clean assembleRelease")
28+
gradle(task: "publishReleasePublicationToSonatypeRepository")
29+
end
30+
31+
end

fastlane/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
fastlane documentation
2+
================
3+
# Installation
4+
5+
Make sure you have the latest version of the Xcode command line tools installed:
6+
7+
```
8+
xcode-select --install
9+
```
10+
11+
Install _fastlane_ using
12+
```
13+
[sudo] gem install fastlane -NV
14+
```
15+
or alternatively using `brew install fastlane`
16+
17+
# Available Actions
18+
## Android
19+
### android test
20+
```
21+
fastlane android test
22+
```
23+
Runs all the tests
24+
### android deploy
25+
### android deployNexus
26+
```
27+
fastlane android deployNexus
28+
```
29+
Deploy libraries to Nexus.
30+
31+
----
32+
33+
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
34+
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
35+
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

fastlane/report.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites>
3+
<testsuite name="fastlane.lanes">
4+
5+
6+
7+
8+
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000146394">
9+
10+
</testcase>
11+
12+
13+
<testcase classname="fastlane.lanes" name="1: clean bundleRelease" time="14.505891043">
14+
15+
</testcase>
16+
17+
18+
<testcase classname="fastlane.lanes" name="2: upload_to_play_store" time="11.349806279">
19+
20+
</testcase>
21+
22+
</testsuite>
23+
</testsuites>

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
# org.gradle.parallel=true
1919
android.useAndroidX=true
2020

21-
VERSION_NAME=1.5.0
2221
GROUP=no.nordicsemi.android.support.v18
2322

2423
POM_DESCRIPTION=Android Bluetooth LE Scanner Compat library

gradle/git-tag-version.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ext.getVersionCodeFromTags = { ->
2+
try {
3+
def code = new ByteArrayOutputStream()
4+
exec {
5+
commandLine 'git', 'tag', '--list'
6+
standardOutput = code
7+
}
8+
return 14 + code.toString().split("\n").size()
9+
}
10+
catch (ignored) {
11+
return -1
12+
}
13+
}
14+
15+
ext.getVersionNameFromTags = { ->
16+
try {
17+
def stdout = new ByteArrayOutputStream()
18+
exec {
19+
commandLine 'git', 'describe', '--tags', '--abbrev=0'
20+
standardOutput = stdout
21+
}
22+
return stdout.toString().trim().split("%")[0]
23+
}
24+
catch (ignored) {
25+
return null
26+
}
27+
}

gradle/publish-module.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
apply plugin: 'maven-publish'
22
apply plugin: 'signing'
3+
apply from: rootProject.file("gradle/git-tag-version.gradle")
34

45
group = GROUP
5-
version = VERSION_NAME
6+
version = getVersionNameFromTags()
67

78
task androidSourcesJar(type: Jar) {
89
archiveClassifier.set('sources')
@@ -24,7 +25,7 @@ afterEvaluate {
2425

2526
groupId = GROUP
2627
artifactId = POM_ARTIFACT_ID
27-
version = VERSION_NAME
28+
version = getVersionNameFromTags()
2829

2930
pom {
3031
name = POM_NAME
@@ -58,9 +59,9 @@ afterEvaluate {
5859
}
5960
}
6061

61-
ext["signing.keyId"] = rootProject.ext["signing.keyId"]
62-
ext["signing.password"] = rootProject.ext["signing.password"]
63-
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]
62+
ext["signing.keyId"] = System.env.GPG_SIGNING_KEY
63+
ext["signing.password"] = System.env.GPG_PASSWORD
64+
ext["signing.secretKeyRingFile"] = "../sec.gpg"
6465

6566
signing {
6667
sign publishing.publications

gradle/publish-root.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ nexusPublishing {
1313

1414
repositories {
1515
sonatype {
16-
stagingProfileId = sonatypeStagingProfileId
17-
username = ossrhUsername
18-
password = ossrhPassword
16+
stagingProfileId = System.env.SONATYPE_STATING_PROFILE_ID
17+
username = System.env.OSSR_USERNAME
18+
password = System.env.OSSR_PASSWORD
1919
}
2020
}
2121

0 commit comments

Comments
 (0)