forked from mParticle/mparticle-android-sdk
-
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
de1f552
commit 8e26f79
Showing
7 changed files
with
281 additions
and
13 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
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,44 @@ | ||
name: Semantic PR Check | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, edited] | ||
jobs: | ||
pr-title-check: | ||
name: Check PR for semantic title | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Set PR title validity | ||
id: is-semantic | ||
if: > | ||
startsWith(github.event.pull_request.title, 'feat:')|| | ||
startsWith(github.event.pull_request.title, 'fix:') || | ||
startsWith(github.event.pull_request.title, 'perf:') || | ||
startsWith(github.event.pull_request.title, 'docs:') || | ||
startsWith(github.event.pull_request.title, 'test:') || | ||
startsWith(github.event.pull_request.title, 'refactor:') || | ||
startsWith(github.event.pull_request.title, 'style:') || | ||
startsWith(github.event.pull_request.title, 'build:') || | ||
startsWith(github.event.pull_request.title, 'ci:') || | ||
startsWith(github.event.pull_request.title, 'chore:') || | ||
startsWith(github.event.pull_request.title, 'revert:') | ||
run: | | ||
OUTPUT=true | ||
echo "::set-output name=isSemantic::$OUTPUT" | ||
- name: echo isSemantic | ||
run: | | ||
echo ${{ steps.is-semantic.outputs.isSemantic }} | ||
- name: PR title is valid | ||
if: ${{steps.is-semantic.outputs.isSemantic == 'true'}} | ||
run: | | ||
echo 'Pull request title is valid.' | ||
echo ${{ steps.is-semantic.outputs.isSemantic }} | ||
- name: PR title is invalid | ||
if: ${{ steps.is-semantic.outputs.isSemantic != 'true'}} | ||
run: | | ||
echo ${{ steps.is-semantic.outputs.isSemantic }} | ||
echo 'Pull request title is not valid.' | ||
exit 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
name: "Release SDK" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: 'Do a dry run to preview instead of a real release [true/false]' | ||
required: true | ||
default: 'true' | ||
|
||
jobs: | ||
# SDK release is done from public/master branch. | ||
confirm-master-branch: | ||
name: "Confirm release is run on master branch" | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: Branch name | ||
run: | | ||
BRANCHNAME=${GITHUB_REF##*/} | ||
echo "pulling branch name, branch name is:" | ||
echo $BRANCHNAME | ||
if [ $BRANCHNAME != "master" ] | ||
then | ||
echo "You can only run a release from the master branch, you are trying to run it from ${BRANCHNAME}" | ||
exit 1 | ||
fi | ||
instrumented-tests: | ||
timeout-minutes: 30 | ||
needs: confirm-master-branch | ||
runs-on: macos-11 | ||
steps: | ||
- name: "Checkout Internal Development Branch" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
repository: mparticle/mparticle-android-sdk-internal | ||
token: ${{ secrets.ANDROID_SDK_PAT }} | ||
ref: development | ||
- name: "Run Instrumented Tests" | ||
uses: reactivecircus/[email protected] | ||
with: | ||
api-level: 29 | ||
script: ./gradlew :android-core:cAT :android-kit-base:cAT --stacktrace | ||
- name: "Archive Instrumented Test Results" | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: test-results | ||
path: android-core/build/reports/androidTests/connected/** | ||
unit-tests: | ||
timeout-minutes: 15 | ||
needs: confirm-master-branch | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: "Checkout Internal Development Branch" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
repository: mparticle/mparticle-android-sdk-internal | ||
token: ${{ secrets.ANDROID_SDK_PAT }} | ||
ref: development | ||
- name: Install JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Run Unit Tests | ||
run: ./gradlew test | ||
- name: Android Test Report | ||
uses: asadmansr/[email protected] | ||
if: ${{ always() }} | ||
update-kits: | ||
needs: [instrumented-tests, unit-tests] | ||
runs-on: macos-11 | ||
env: | ||
GIT_AUTHOR_NAME: mparticle-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: mparticle-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
steps: | ||
- name: "Checkout Internal Development Branch" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
repository: mparticle/mparticle-android-sdk-internal | ||
token: ${{ secrets.ANDROID_SDK_PAT }} | ||
ref: development | ||
submodules: recursive | ||
- name: "Build Android Core" | ||
run: ./gradlew -Ptarget_maven_repo=test -PisRelease=true cleanBuildCache clean testRelease uploadArchives | ||
- name: "Update Kit references" | ||
run: git submodule foreach "git fetch; git reset --hard origin/master"; | ||
- name: "Test Kits" | ||
run: ./gradlew -Ptarget_maven_repo=test -PisRelease=true cleanBuildCache clean testRelease uploadArchives -c settings-kits.gradle | ||
- name: "Commit Kit Updates" | ||
run: git add .; git diff-index --quiet HEAD || git commit -m 'Update Submodules' | ||
# - name: "Upload kit branch" | ||
# run: git push origin HEAD:release/${GITHUB_RUN_ID} | ||
semantic-release: | ||
needs: update-kits | ||
runs-on: ubuntu-18.04 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ANDROID_SDK_PAT }} | ||
GIT_AUTHOR_NAME: mparticle-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: mparticle-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
steps: | ||
- name: "Checkout public/master Branch" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
repository: ${{ github.repository }} | ||
token: ${{ secrets.ANDROID_SDK_PAT }} | ||
ref: master | ||
- name: "Add new internal/development branch commits to public/master for release" | ||
run: | | ||
git remote add internal https://${{ secrets.ANDROID_SDK_PAT }}@github.com/mParticle/mparticle-android-sdk-internal.git | ||
git fetch internal | ||
git pull internal development | ||
- name: "Semantic Release --dry-run" | ||
if: ${{ github.event.inputs.dryRun == 'true'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ANDROID_SDK_PAT }} | ||
GIT_AUTHOR_NAME: mparticle-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: mparticle-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release --dry-run | ||
- name: "Semantic Release" | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ANDROID_SDK_PAT }} | ||
GIT_AUTHOR_NAME: mparticle-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: mparticle-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release | ||
- name: "Merge back release commits to public/master repository" | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
run: | | ||
git push origin HEAD:master | ||
- name: "Merge back release commits to internal/development repository" | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
run: | | ||
git push internal HEAD:development | ||
git push internal HEAD:master | ||
# - name: "Publish Core to Maven" | ||
# if: ${{ github.event.inputs.dryRun == 'false'}} | ||
# env: | ||
# MAVEN_KEY: ${{ secrets.MAVEN_KEY }} | ||
# MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }} | ||
# SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
# SIGNING_KEY_RING_FILE: ${{ secrets.SIGNING_KEY_RING_FILE }} | ||
# SIGNING_KEY_RING_PASSWORD: ${{ secrets.SIGNING_KEY_RING_PASSWORD }} | ||
# run: | | ||
# ./gradlew cleanBuildCache clean test | ||
# ./gradlew uploadArchives -Ptarget_maven_repo=sonatype -PisRelease=true | ||
# - name: "Publish Kits to Maven" | ||
# if: ${{ github.event.inputs.dryRun == 'false'}} | ||
# env: | ||
# MAVEN_KEY: ${{ secrets.MAVEN_KEY }} | ||
# MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }} | ||
# SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
# SIGNING_KEY_RING_FILE: ${{ secrets.SIGNING_KEY_RING_FILE }} | ||
# SIGNING_KEY_RING_PASSWORD: ${{ secrets.SIGNING_KEY_RING_PASSWORD }} | ||
# run: | | ||
# ./gradlew cleanBuildCache clean test | ||
# ./gradlew uploadArchives -c settings-kits.gradle -Ptarget_maven_repo=sonatype -PisRelease=true |
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,39 @@ | ||
module.exports = { | ||
branches: ["master"], | ||
tagFormat: "v${version}", | ||
plugins: [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
preset: "angular", | ||
}, | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
preset: "angular", | ||
}, | ||
], | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
changelogFile: "CHANGELOG.md", | ||
}, | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
prepareCmd: "sh ./scripts/release.sh ${nextRelease.version}", | ||
}, | ||
], | ||
// ["@semantic-release/github"], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
assets: ["CHANGELOG.md", "build.gradle", "README.md"], | ||
message: | ||
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", | ||
}, | ||
], | ||
], | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,11 +14,11 @@ sed -i '.bak' "s/'com.mparticle:android-another-kit:.*'/'com.mparticle:android-a | |
#commit the version bump, tag, and push to private and public | ||
git add build.gradle | ||
git add README.md | ||
git commit -m "Update version to $1" | ||
git tag "v$1" | ||
git push origin "v$1" | ||
git remote add public [email protected]:mParticle/mparticle-android-sdk.git | ||
git push public "v$1" | ||
git push origin HEAD:development | ||
git push origin HEAD:master | ||
git push public HEAD:master | ||
# git commit -m "Update version to $1" | ||
# git tag "v$1" | ||
# git push origin "v$1" | ||
# git remote add public [email protected]:mParticle/mparticle-android-sdk.git | ||
# git push public "v$1" | ||
# git push origin HEAD:development | ||
# git push origin HEAD:master | ||
# git push public HEAD:master |