Skip to content

Commit

Permalink
CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterBin committed Jun 4, 2024
1 parent 1a7907f commit a1b0e95
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 149 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/neutral-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:

- uses: gradle/gradle-build-action@v3
- run: |
cd ${{ github.workspace }}/vico
VERSION_NAME=$(grep -oP "(?<=version_name).*(?=\",)" versions.gradle | grep -oP "(?<=\").*")
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "TAG_NAME=v$VERSION_NAME" >> $GITHUB_ENV
./gradlew assembleDebug
- name: Create tag
Expand All @@ -40,7 +40,7 @@ jobs:
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.VERSION_NAME }}",
ref: "refs/tags/${{ env.VERSION_NAME }}-tangem${{ github.run_number }}",
sha: context.sha
})
Expand All @@ -49,18 +49,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
run: |
cd ${{ github.workspace }}/vico
echo sdk.dir = $ANDROID_HOME > local.properties
./gradlew -PgithubUser=${{ secrets.GITHUB_ACTOR }} -PgithubPass=${{ secrets.GITHUB_TOKEN }} -PartifactVersion=${{ env.VERSION_NAME }} publish
./gradlew -PgithubUser=${{ secrets.GITHUB_ACTOR }} -PgithubPass=${{ secrets.GITHUB_TOKEN }} -PpublishVersion=${{ env.VERSION_NAME }}-tangem${{ github.run_number }} publish
- name: Build notification
if: always()
uses: adamkdean/simple-slack-notify@master
with:
channel: '#development-android'
status: ${{ job.status }}
success_text: 'Tangem Vico library build (${{ env.VERSION_NAME }}) has been created and uploaded to Nexus.'
success_text: 'Tangem Vico library build (${{ env.VERSION_NAME }}-tangem${{ github.run_number }}) has been created and uploaded to Nexus.'
failure_text: 'GitHub Action #${{ github.run_number }} failed. Tag has not been not created.'
cancelled_text: 'GitHub Action #${{ github.run_number }} was cancelled'
fields: |
[{"title": "TAG", "value": "${{ env.VERSION_NAME }}"},
[{"title": "TAG", "value": "${{ env.VERSION_NAME }}-tangem${{ github.run_number }}"},
{"title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
59 changes: 26 additions & 33 deletions common-scripts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'maven-publish'

android {

Expand Down Expand Up @@ -48,18 +49,35 @@ android {

ext {
getNamespace = this.&getNamespace
getArtifactId = this.&getArtifactId
customizePom = this.&customizePom
setUpRepositories = this.&setUpRepositories
setUpSigning = this.&setUpSigning
}

String getNamespace(Project project) {
return "${library.groupId}.${project.name.replace("-", ".")}"
afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
groupId = library.publishGroupId
artifactId = project.name
version = library.publishVersion
from components.release

customizePom(pom)
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/tangem/vico")
credentials {
username = "$githubUser"
password = "$githubPass"
}
}
}
}
}

String getArtifactId(Project project) {
return project.name
String getNamespace(Project project) {
return "${library.groupId}.${project.name.replace("-", ".")}"
}

void customizePom(MavenPom pom) {
Expand All @@ -75,29 +93,4 @@ void customizePom(MavenPom pom) {
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

pom.scm {
connection = "scm:git:git://github.com/tangem/vico.git"
developerConnection = "scm:git:ssh://github.com/tangem/vico.git"
url = "https://github.com/patrykandpatrick/vico"
}
}

boolean isReleaseVersion() {
return !project.version.endsWith("SNAPSHOT")
}

void setUpRepositories(RepositoryHandler handler) {
handler.maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/tangem/vico")
credentials {
username = "$githubUser"
password = "$githubPass"
}
}
}

void setUpSigning(SigningExtension signing, MavenPublication publication) {

}
4 changes: 3 additions & 1 deletion versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ ext {

library = [
groupId : "com.patrykandpatrick.vico",
version_name : "2.0.0-alpha.21-tangem1",
publishGroupId : "com.tangem.vico",
version_name : "2.0.0-alpha.21",
publishVersion : project.hasProperty('publishVersion') ? project.getProperty('publishVersion') : '0.0.1',
version_code : 1,
target_sdk : 34,
min_sdk : 19,
Expand Down
22 changes: 0 additions & 22 deletions vico/compose-m2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,6 @@ android {
}
}

afterEvaluate {

publishing {

publications {

VicoComposeM2(MavenPublication) {

groupId = library.groupId
artifactId = getArtifactId(project)
version = project.version
from components.release

customizePom(pom)
setUpRepositories(repositories)
}
}
}

setUpSigning(signing, publishing.publications.VicoComposeM2)
}

dependencies {

api project(":vico:compose")
Expand Down
22 changes: 0 additions & 22 deletions vico/compose-m3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,6 @@ android {
}
}

afterEvaluate {

publishing {

publications {

VicoComposeM3(MavenPublication) {

groupId = library.groupId
artifactId = getArtifactId(project)
version = project.version
from components.release

customizePom(pom)
setUpRepositories(repositories)
}
}
}

setUpSigning(signing, publishing.publications.VicoComposeM3)
}

dependencies {

api project(":vico:compose")
Expand Down
22 changes: 0 additions & 22 deletions vico/compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,6 @@ android {
}
}

afterEvaluate {

publishing {

publications {

VicoCompose(MavenPublication) {

groupId = library.groupId
artifactId = getArtifactId(project)
version = project.version
from components.release

customizePom(pom)
setUpRepositories(repositories)
}
}
}

setUpSigning(signing, publishing.publications.VicoCompose)
}

dependencies {

api project(":vico:core")
Expand Down
22 changes: 0 additions & 22 deletions vico/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,6 @@ android {
}
}

afterEvaluate {

publishing {

publications {

VicoCore(MavenPublication) {

groupId = library.groupId
artifactId = getArtifactId(project)
version = project.version
from components.release

customizePom(pom)
setUpRepositories(repositories)
}
}
}

setUpSigning(signing, publishing.publications.VicoCore)
}

dependencies {
implementation libs.androidXAnnotation
implementation libs.coroutinesCore
Expand Down
22 changes: 0 additions & 22 deletions vico/views/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,6 @@ android {
}
}

afterEvaluate {

publishing {

publications {

VicoView(MavenPublication) {

groupId = library.groupId
artifactId = getArtifactId(project)
version = project.version
from components.release

customizePom(pom)
setUpRepositories(repositories)
}
}
}

setUpSigning(signing, publishing.publications.VicoView)
}

dependencies {

api project(":vico:core")
Expand Down

0 comments on commit a1b0e95

Please sign in to comment.