-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfa7aed
commit abfc0bf
Showing
7 changed files
with
210 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function bump { | ||
local mode="$1" | ||
local old="$2" | ||
local parts=(${old//./ }) | ||
case "$1" in | ||
major) | ||
local bv=$((parts[0] + 1)) | ||
NEW_VERSION="${bv}.0.0" | ||
;; | ||
minor) | ||
local bv=$((parts[1] + 1)) | ||
NEW_VERSION="${parts[0]}.${bv}.0" | ||
;; | ||
patch) | ||
local bv=$((parts[2] + 1)) | ||
NEW_VERSION="${parts[0]}.${parts[1]}.${bv}" | ||
;; | ||
esac | ||
} | ||
|
||
BUMP_MODE="patch" | ||
|
||
if [ -n "$1" ]; then | ||
BUMP_MODE=$1 | ||
fi | ||
|
||
OLD_VERSION=$(./gradlew -q printVersionName) | ||
NEW_VERSION="-" | ||
|
||
bump $BUMP_MODE $OLD_VERSION | ||
echo "version will be bumped from" $OLD_VERSION "to" $NEW_VERSION | ||
|
||
#save outputs | ||
echo "OLD_VERSION=${OLD_VERSION}" >> $GITHUB_OUTPUT | ||
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
REPO="https://$GITHUB_ACTOR:$TOKEN@github.com/$GITHUB_REPOSITORY.git" | ||
OLD_VERSION="$1" | ||
NEW_VERSION="$2" | ||
VB_VERSION=$(./gradlew -q printVersionName) | ||
VERSION_FILE=./gradle.properties | ||
|
||
sed -i "s/\(version *= *['\"]*\)${VB_VERSION}\(['\"]*\)/\1${NEW_VERSION}\2/" ${VERSION_FILE} | ||
|
||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git add $VERSION_FILE | ||
git commit -m "Bump version from $OLD_VERSION to $NEW_VERSION [skip ci]" | ||
git push $REPO | ||
|
||
# check version is bumped | ||
CURRENT_VERSION=$(./gradlew -q printVersionName) | ||
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish Package to GitHub Packages | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
jobs: | ||
publish-aar: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Setup JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'corretto' | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
- name: Linting | ||
run: ./gradlew ciLint | ||
- name: Unit Tests | ||
run: ./gradlew checkTestCoverage | ||
- name: Build Android aar | ||
run: ./gradlew tyro-pay-android:assemble | ||
- name: Publish aar to GitHub Packages | ||
run: ./gradlew publish | ||
env: | ||
GITHUB_PACKAGES_USER: ${{github.actor}} | ||
GITHUB_PACKAGES_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Release CI | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-type: | ||
description: 'Select release type' | ||
required: true | ||
default: 'draft' | ||
type: choice | ||
options: | ||
- draft | ||
- prerelease | ||
- release | ||
|
||
jobs: | ||
git-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Setup JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'corretto' | ||
- name : Retrieve Version Name | ||
run: echo "VERSION=$(./gradlew -q printVersionName -Pprefix=v)" >> $GITHUB_OUTPUT | ||
id: android_version | ||
- name: Print Version Name | ||
run: echo "release version ${{steps.android_version.outputs.VERSION}}" | ||
- name: Create GitHub Tag and Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
${{ inputs.release-type }}: true | ||
generateReleaseNotes: true | ||
tag: "${{steps.android_version.outputs.VERSION}}" | ||
commit: "master" | ||
publish-aar: | ||
needs: git-release | ||
if: ${{inputs.release-type != 'draft'}} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Setup JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'corretto' | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
- name: Linting | ||
run: ./gradlew ciLint | ||
- name: Unit Tests | ||
run: ./gradlew checkTestCoverage | ||
- name: Build Android aar | ||
run: ./gradlew tyro-pay-android:assemble | ||
- name: Publish aar to GitHub Packages | ||
run: ./gradlew publish | ||
env: | ||
GITHUB_PACKAGES_USER: ${{github.actor}} | ||
GITHUB_PACKAGES_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Bump Version | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
bump-mode: | ||
description: 'Select bump mode' | ||
required: true | ||
default: 'patch' | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
bump-version: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Setup JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'corretto' | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
- name: Retrieve New Version | ||
run: bash ./.ci_steps/bump.sh ${{inputs.bump-mode}} | ||
id: bump | ||
- name: 'Checkout version-bump branch' | ||
run: | | ||
git fetch origin version-bump | ||
git checkout version-bump | ||
- name: Print Current Branch | ||
run: echo "$(git branch --show-current)" | ||
- name: Update Version to version-bump Branch | ||
run: bash ./.ci_steps/update-version.sh ${{steps.bump.outputs.OLD_VERSION}} ${{steps.bump.outputs.NEW_VERSION}} | ||
id: update | ||
- name: Print Bump Results | ||
run: | | ||
echo "New Version: ${{steps.update.outputs.CURRENT_VERSION}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters