Skip to content

Commit

Permalink
separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
TpayDev committed Oct 11, 2023
0 parents commit 77f0595
Show file tree
Hide file tree
Showing 560 changed files with 16,715 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and publish

on:
pull_request:
branches:
- main
types:
- closed

env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_LOGIN: ${{ secrets.MAVEN_LOGIN }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
STAGING_MAVEN_URL: ${{ secrets.STAGING_MAVEN_URL }}
STAGING_MAVEN_LOGIN: ${{ secrets.STAGING_MAVEN_LOGIN }}
STAGING_MAVEN_PASSWORD: ${{ secrets.STAGING_MAVEN_PASSWORD }}

jobs:
build_and_publish:
if: github.event.pull_request.merged && (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
runs-on: ubuntu-latest
steps:
- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for hotfix branches)
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Checkout source
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.9.0

- name: Gradle clean
run: ./gradlew clean

- name: Gradle generate documentation
run: ./gradlew sdk:generateDocumentation

- name: Gradle prepare sources
run: ./gradlew sdk:sourcesJar

- name: Gradle build
run: ./gradlew sdk:assembleRelease

- name: Publish to Maven Central
run: ./gradlew sdk:publishReleasePublicationToMavenCentralRepository

- name: Create Github release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_VERSION }}
body: "Release is available on Maven Central repository. Add > implementation \"com.tpay:sdk:${{ env.RELEASE_VERSION }}\" < to your app level build.gradle file."
65 changes: 65 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create release

on:
workflow_dispatch:
inputs:
version:
description: 'Version to create'
required: true

env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_LOGIN: ${{ secrets.MAVEN_LOGIN }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
STAGING_MAVEN_URL: ${{ secrets.STAGING_MAVEN_URL }}
STAGING_MAVEN_LOGIN: ${{ secrets.STAGING_MAVEN_LOGIN }}
STAGING_MAVEN_PASSWORD: ${{ secrets.STAGING_MAVEN_PASSWORD }}

jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.9.0

- name: Gradle generate documentation
run: ./gradlew sdk:generateDocumentation

- name: Copy generated documentation
run: cp -r ./sdk/build/dokka/javadoc/ ./docs

- name: Configure Git
run: |
git config user.name "Tpay CI"
git config user.email ci-noreply@tpay.com
- name: Create release branch
run: git checkout -b release/${{ github.event.inputs.version }}

- name: Commit docs
run: |
git add docs/
git commit --allow-empty -m "Update docs"
- name: Push release branch
run: git push origin release/${{ github.event.inputs.version }}

- name: Create pull request
uses: thomaseizinger/create-pull-request@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/${{ github.event.inputs.version }}
base: main
title: ${{ github.event.inputs.version }} into main
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*.iml
.gradle
.idea
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/misc.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/.idea/kotlinc.xml
67 changes: 67 additions & 0 deletions .gitlab-ci-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# CLEAN
clean:
tags: [android]
stage: clean
only:
- tags
script:
- ./gradlew clean

# TESTS
sdk:test:release:
tags: [android]
stage: test
only:
- /^\d+\.\d+\.\d+/
script:
- ./gradlew sdk:testReleaseUnitTest
artifacts:
reports:
junit: sdk/build/test-results/testReleaseUnitTest/TEST-*.xml

# DOCUMENTATION
sdk:documentation:release:
tags: [android]
stage: documentation
only:
- /^\d+\.\d+\.\d+/
script:
- ./gradlew sdk:generateDocumentation
artifacts:
paths:
- sdk/build/libs/

# SOURCES
sdk:sources:release:
tags: [android]
stage: sources
only:
- /^\d+\.\d+\.\d+/
script:
- ./gradlew sdk:sourcesJar
artifacts:
paths:
- sdk/build/libs/


# BUILD
sdk:build:release:
tags: [android]
stage: build
only:
- /^\d+\.\d+\.\d+$/
script:
- ./gradlew sdk:assembleRelease
artifacts:
paths:
- sdk/build/outputs/aar/
expire_in: 1 day

# DEPLOY
sdk:deploy:release:
tags: [android]
stage: deploy
only:
- /^\d+\.\d+\.\d+/
script:
- ./gradlew sdk:publishReleasePublicationToStagingRepository
26 changes: 26 additions & 0 deletions .gitlab-ci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Sync to GitHub:
stage: release
image: docker:stable
only:
- tags
except:
- branches
when: manual
script:
- TMP_DIR="/tmp/${CI_COMMIT_SHA}"
- WORKDIR=$(pwd)
- rm -Rf .git/
- mkdir ${TMP_DIR}
- cd ${TMP_DIR}
- git clone git@github.com:tpay-com/tpay-android.git .
- git config user.name "Tpay Auto Commit"
- git config user.email "devs@tpay.com"
- cp -rT ${WORKDIR} .
- rm .gitlab-ci.yml
- git add ./
- git commit -m "${CI_COMMIT_MESSAGE}"
- git push
- git tag ${CI_COMMIT_TAG}
- git push --tags
- cd ${WORKDIR}
- rm ${TMP_DIR} -Rf
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Krajowy Integrator Płatności Spółka Akcyjna

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 77f0595

Please sign in to comment.