Publish #12
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: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
versionName: | |
description: 'Version Name' | |
required: true | |
jobs: | |
publish: | |
name: Publish | |
runs-on: macos-latest # Using macOS runner for Apple platform builds | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Setup Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Verify Node.js Setup | |
run: | | |
node --version | |
npm --version | |
echo "Node.js modules directory:" | |
ls -la ./colorpicker/build/js/node_modules || true | |
- name: Install CocoaPods | |
run: gem install cocoapods | |
- name: Grant Permission to Execute Gradle | |
run: chmod +x gradlew | |
- name: Build Android | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: assembleRelease | |
- name: Build iOS | |
run: ./gradlew iosX64MainKlibrary iosArm64MainKlibrary iosSimulatorArm64MainKlibrary | |
- name: Build macOS | |
run: ./gradlew macosArm64MainKlibrary | |
- name: Build JavaScript | |
run: | | |
echo "Building JavaScript..." | |
./gradlew colorpicker:jsPackageJson | |
./gradlew colorpicker:kotlinNodeJsSetup | |
./gradlew colorpicker:jsNodeProductionRun --stacktrace | |
echo "Verifying build output..." | |
ls -la ./colorpicker/build/compileSync/js/main/productionExecutable/colorpicker.js || true | |
- name: Build JVM | |
run: ./gradlew jvmJar | |
- name: Publish Library | |
run: | | |
echo "Publishing and Releasing library 🚀" | |
./gradlew publish --no-configuration-cache | |
echo "Published and Released ✅" | |
env: | |
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} | |
- name: Create and push tag | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "$GITHUB_ACTOR" | |
git tag -a $TAG -m "Release v$TAG" | |
git push origin $TAG | |
env: | |
TAG: ${{ github.event.inputs.versionName }} | |
- name: Create Release on GitHub | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.versionName }} | |
release_name: ${{ github.event.inputs.versionName }} | |
draft: true | |
prerelease: false | |
- name: Upload Android Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./colorpicker/build/outputs/aar/colorpicker-release.aar | |
asset_name: colorpicker-${{ github.event.inputs.versionName }}.aar | |
asset_content_type: application/zip | |
- name: Upload JavaScript Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./colorpicker/build/compileSync/js/main/productionExecutable/colorpicker.js | |
asset_name: colorpicker-${{ github.event.inputs.versionName }}.js | |
asset_content_type: application/javascript |