Skip to content

Release Automation

Release Automation #28

Workflow file for this run

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