Skip to content

Commit

Permalink
Release scripts updated
Browse files Browse the repository at this point in the history
  • Loading branch information
philips77 committed Oct 1, 2021
1 parent decb68e commit 433bf05
Show file tree
Hide file tree
Showing 12 changed files with 1,518 additions and 9 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy to Nexus
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
generateReadme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- shell: bash
run: |
git config user.email [email protected]
git config user.name "Github Action"
VERSION=`git describe --tags --abbrev=0`
VERSION=`./moustache/split.sh $VERSION`
rm -f ./README.md
VERSION=$VERSION ./moustache/mo ./moustache/README.mo > ./README.md
git add .
git commit -m "Update readme to version=$VERSION"
git push
deployAarsToNexus:
needs: generateReadme
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- shell: bash
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
OSSR_USERNAME: ${{ secrets.OSSR_USERNAME }}
OSSR_PASSWORD: ${{ secrets.OSSR_PASSWORD }}
SONATYPE_STATING_PROFILE_ID: ${{ secrets.SONATYPE_STATING_PROFILE_ID }}
run: |
echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc
gpg -d --passphrase "${{ secrets.GPG_FILE_PSWD }}" --batch sec.gpg.asc > sec.gpg
bundle exec fastlane deployNexus
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
31 changes: 31 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

platform :android do

desc "Runs all the tests"
lane :test do
gradle(task: "test")
end

desc "Deploy libraries to Nexus."
lane :deployNexus do
gradle(task: "clean assembleRelease")
gradle(task: "publishReleasePublicationToSonatypeRepository")
end

end
35 changes: 35 additions & 0 deletions fastlane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
fastlane documentation
================
# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```
xcode-select --install
```

Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew install fastlane`

# Available Actions
## Android
### android test
```
fastlane android test
```
Runs all the tests
### android deploy
### android deployNexus
```
fastlane android deployNexus
```
Deploy libraries to Nexus.

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
23 changes: 23 additions & 0 deletions fastlane/report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="fastlane.lanes">




<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000146394">

</testcase>


<testcase classname="fastlane.lanes" name="1: clean bundleRelease" time="14.505891043">

</testcase>


<testcase classname="fastlane.lanes" name="2: upload_to_play_store" time="11.349806279">

</testcase>

</testsuite>
</testsuites>
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# org.gradle.parallel=true
android.useAndroidX=true

VERSION_NAME=1.5.0
GROUP=no.nordicsemi.android.support.v18

POM_DESCRIPTION=Android Bluetooth LE Scanner Compat library
Expand Down
27 changes: 27 additions & 0 deletions gradle/git-tag-version.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ext.getVersionCodeFromTags = { ->
try {
def code = new ByteArrayOutputStream()
exec {
commandLine 'git', 'tag', '--list'
standardOutput = code
}
return 14 + code.toString().split("\n").size()
}
catch (ignored) {
return -1
}
}

ext.getVersionNameFromTags = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--abbrev=0'
standardOutput = stdout
}
return stdout.toString().trim().split("%")[0]
}
catch (ignored) {
return null
}
}
11 changes: 6 additions & 5 deletions gradle/publish-module.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply from: rootProject.file("gradle/git-tag-version.gradle")

group = GROUP
version = VERSION_NAME
version = getVersionNameFromTags()

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

groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME
version = getVersionNameFromTags()

pom {
name = POM_NAME
Expand Down Expand Up @@ -58,9 +59,9 @@ afterEvaluate {
}
}

ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]
ext["signing.keyId"] = System.env.GPG_SIGNING_KEY
ext["signing.password"] = System.env.GPG_PASSWORD
ext["signing.secretKeyRingFile"] = "../sec.gpg"

signing {
sign publishing.publications
Expand Down
6 changes: 3 additions & 3 deletions gradle/publish-root.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ nexusPublishing {

repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
stagingProfileId = System.env.SONATYPE_STATING_PROFILE_ID
username = System.env.OSSR_USERNAME
password = System.env.OSSR_PASSWORD
}
}

Expand Down
Loading

0 comments on commit 433bf05

Please sign in to comment.