Release #38
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
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: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/collaborators/${{ github.actor }} | |
repository: ${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [authorize] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 8 | |
distribution: 'zulu' | |
- name: Build | |
run: ./gradlew build | |
- name: Lint | |
run: ./gradlew ktlintCheck | |
- name: Test | |
run: ./gradlew test --info | |
- name: Docs | |
run: ./gradlew docs | |
- name: Configure GPG | |
env: | |
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
run: | | |
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'" | |
- name: Configure Sonatype | |
env: | |
GRADLE_PROP_FILE: local.properties | |
run: | | |
echo "ossrhUsername=${{ secrets.OSSRH_USERNAME }}" >> $GRADLE_PROP_FILE | |
echo "ossrhPassword=${{ secrets.OSSRH_PASSWORD }}" >> $GRADLE_PROP_FILE | |
echo "sonatypeStagingProfileId=${{ secrets.SONATYPE_STAGING_PROFILE_ID }}" >> $GRADLE_PROP_FILE | |
echo "signing.keyId=${{ secrets.SIGNING_KEY_ID }}" >> $GRADLE_PROP_FILE | |
echo "signing.password=${{ secrets.SIGNING_PASSWORD }}" >> $GRADLE_PROP_FILE | |
echo "signing.secretKeyRingFile=${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}" >> $GRADLE_PROP_FILE | |
- 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 \ | |
-p @semantic-release/changelog \ | |
-p @semantic-release/git \ | |
-p @google/semantic-release-replace-plugin \ | |
-p @semantic-release/exec \ | |
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] | |
run: | | |
npx \ | |
-p lodash \ | |
-p semantic-release \ | |
-p @semantic-release/changelog \ | |
-p @semantic-release/git \ | |
-p @google/semantic-release-replace-plugin \ | |
-p @semantic-release/exec \ | |
semantic-release |