-
Notifications
You must be signed in to change notification settings - Fork 10
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
5ae0c51
commit 42e0261
Showing
3 changed files
with
157 additions
and
0 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,88 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: 'Do a dry run to preview instead of a real release' | ||
required: true | ||
default: 'true' | ||
|
||
jobs: | ||
authorize: | ||
name: Authorize | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ${{ github.actor }} permission check to do a release | ||
uses: "lannonbr/[email protected]" | ||
with: | ||
permission: "write" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [authorize] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ssh-key: ${{ secrets.DEPLOY_KEY }} | ||
|
||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'zulu' | ||
|
||
- name: Build | ||
run: ./gradlew build | ||
|
||
- name: Test | ||
run: ./gradlew test --info | ||
|
||
- name: Configure GPG | ||
run: | | ||
echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > 'secring.gpg' | ||
- name: Semantic Release --dry-run | ||
if: ${{ github.event.inputs.dryRun == 'true'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_NAME: amplitude-sdk-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: amplitude-sdk-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 @google/semantic-release-replace-plugin@1 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release --dry-run | ||
- name: Semantic Release | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_NAME: amplitude-sdk-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: amplitude-sdk-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
SECURE_REPO_USER: ${{ secrets.OSSRH_USERNAME }} | ||
SECURE_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_SECRET_RING_FILE: ../../secring.gpg | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @google/semantic-release-replace-plugin@1 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release |
Empty file.
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,69 @@ | ||
module.exports = { | ||
"branches": [ | ||
{name: 'beta', prerelease: true}, | ||
"main" | ||
], | ||
"tagFormat": ["v${version}"], | ||
"plugins": [ | ||
["@semantic-release/commit-analyzer", { | ||
"preset": "angular", | ||
"parserOpts": { | ||
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"] | ||
} | ||
}], | ||
["@semantic-release/release-notes-generator", { | ||
"preset": "angular", | ||
}], | ||
["@semantic-release/changelog", { | ||
"changelogFile": "CHANGELOG.md" | ||
}], | ||
"@semantic-release/github", | ||
[ | ||
"@google/semantic-release-replace-plugin", | ||
{ | ||
"replacements": [ | ||
{ | ||
"files": ["gradle.properties"], | ||
"from": "ARTIFACT_VERSION=.*", | ||
"to": "ARTIFACT_VERSION=${nextRelease.version}", | ||
"results": [ | ||
{ | ||
"file": "gradle.properties", | ||
"hasChanged": true, | ||
"numMatches": 1, | ||
"numReplacements": 1 | ||
} | ||
], | ||
"countMatches": true | ||
}, | ||
{ | ||
"files": ["src/main/java/com/amplitude/Constants.java"], | ||
"from": "String SDK_VERSION = \".*\";", | ||
"to": "String SDK_VERSION = \"${nextRelease.version}\";", | ||
"results": [ | ||
{ | ||
"file": "src/main/java/com/amplitude/Constants.java", | ||
"hasChanged": true, | ||
"numMatches": 1, | ||
"numReplacements": 1 | ||
} | ||
], | ||
"countMatches": true | ||
}, | ||
] | ||
} | ||
], | ||
["@semantic-release/git", { | ||
"assets": ["gradle.properties", "CHANGELOG.md", "src/main/java/com/amplitude/Constants.java"], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
}], | ||
["@semantic-release/exec", { | ||
"publishCmd": `./gradlew publishMavenJavaPublicationToMySecureRepository \ | ||
-PmySecureRepositoryUsername="$SECURE_REPO_USER" \ | ||
-PmySecureRepositoryPassword="$SECURE_REPO_PASSWORD" \ | ||
-Psigning.keyId="$SIGNING_KEY_ID" \ | ||
-Psigning.password="$SIGNING_PASSWORD" \ | ||
-Psigning.secretKeyRingFile="$SIGNING_SECRET_RING_FILE"`, | ||
}], | ||
], | ||
} |