Release Automation #30
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 Automation | |
on: | |
workflow_dispatch: | |
inputs: | |
version-bump: | |
description: The scale of the version bump required for semver compatibility | |
required: true | |
default: patch | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
concurrency: release | |
env: | |
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false | |
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 4 --no-daemon | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ANDROID_SIGNING_GPG }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ANDROID_SIGNING_KEY_ID }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} | |
jobs: | |
release: | |
name: Release Bindings for Kotlin, Swift & Typescript | |
runs-on: ubuntu-latest | |
steps: | |
- name: ๐งฎ Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.ELEMENT_BOT_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
cache: "yarn" | |
- name: ๐๏ธ Setup | |
run: "./scripts/setup.sh" | |
- name: ๐จ Generate json | |
run: "./scripts/generateJson.sh" | |
- name: ๐ Bump yarn version | |
run: | | |
yarn version --no-git-tag-version --${{ github.event.inputs.version-bump }} | |
- name: ๐ Set the version in env | |
run: | | |
echo "NEW_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV | |
- name: ๐ Sync the version with android | |
run: | | |
./scripts/update_android_version.sh ${{ env.NEW_VERSION }} | |
- name: ๐ Commit the version | |
run: | | |
git config --global user.name 'ElementRobot' | |
git config --global user.email '[email protected]' | |
git commit -am "${{ github.event.inputs.version-bump }} version bump" | |
git push | |
- name: ๐ ๏ธ Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: โฌ๏ธ Publish to Sonatype | |
uses: gradle/gradle-build-action@v2 | |
with: | |
build-root-directory: platforms/android | |
arguments: publishAllPublicationsToMavenCentral | |
- name: ๐ Close staging repo and release version | |
uses: gradle/gradle-build-action@v2 | |
with: | |
build-root-directory: platforms/android | |
arguments: closeAndReleaseRepository | |
- name: ๐ Publish to npm | |
id: npm-publish | |
uses: JS-DevTools/npm-publish@5a85faf05d2ade2d5b6682bfe5359915d5159c6c # v2.2.1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
ignore-scripts: false | |
- name: ๐งฌ Create release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.NEW_VERSION }} | |
release_name: Release ${{ env.NEW_VERSION }} | |
body: ${{ env.NEW_VERSION }} Release | |
draft: false | |
prerelease: false |