Update release action #91
Workflow file for this run
This file contains hidden or 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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| apk: | |
| name: Generate APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set execution flag for gradlew | |
| run: chmod +x gradlew | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android Build Tools | |
| run: sdkmanager "build-tools;29.0.3" | |
| - name: Run common unit tests | |
| run: bash ./gradlew :common:cleanTestDebugUnitTest :common:testDebugUnitTest | |
| - name: Build APK | |
| run: bash ./gradlew assembleRelease --stacktrace | |
| - name: Sign APK | |
| uses: r0adkll/sign-android-release@v1 | |
| with: | |
| releaseDirectory: android/build/outputs/apk/release | |
| signingKeyBase64: ${{ secrets.KEYSTORE_B64 }} | |
| alias: ${{ secrets.KEY_ALIAS }} | |
| keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
| keyPassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
| - name: Upload APK Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: signed-apk | |
| path: android/build/outputs/apk/release/android-release-unsigned-signed.apk | |
| - name: Build cli JAR | |
| run: bash ./gradlew :cli:createJar | |
| - name: Upload cli JAR Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cli-jar | |
| path: cli/build/libs/linuxcommandlibrary.jar | |
| dmg: | |
| name: Generate DMG | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set execution flag for gradlew | |
| run: chmod +x gradlew | |
| - name: Build DMG | |
| run: ./gradlew :desktopApp:packageDmg | |
| - name: Upload DMG Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dmg | |
| path: desktopApp/build/compose/binaries/main/dmg/*.dmg | |
| msi: | |
| name: Generate MSI | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Build MSI | |
| run: ./gradlew :desktopApp:packageMsi | |
| - name: Upload MSI Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: msi | |
| path: desktopApp/build/compose/binaries/main/msi/*.msi | |
| deb: | |
| name: Generate DEB | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set execution flag for gradlew | |
| run: chmod +x gradlew | |
| - name: Build DEB | |
| run: ./gradlew :desktopApp:packageDeb | |
| - name: Upload DEB Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deb | |
| path: desktopApp/build/compose/binaries/main/deb/*.deb | |
| release: | |
| name: Release All Platforms | |
| needs: [apk, dmg, msi, deb] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download APK Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: signed-apk | |
| path: artifacts/apk | |
| - name: Download JAR Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cli-jar | |
| path: artifacts/jar | |
| - name: Download DMG Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dmg | |
| path: artifacts/dmg | |
| - name: Download MSI Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: msi | |
| path: artifacts/msi | |
| - name: Download DEB Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: deb | |
| path: artifacts/deb | |
| - name: Extract version and rename assets | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| # Rename APK | |
| mv artifacts/apk/android-release-unsigned-signed.apk artifacts/LinuxCommandLibrary-${VERSION}-android.apk | |
| # Rename JAR | |
| mv artifacts/jar/linuxcommandlibrary.jar artifacts/linuxcommandlibrary-${VERSION}.jar | |
| # Rename DMG (find the actual file) | |
| DMG_FILE=$(find artifacts/dmg -name "*.dmg" | head -1) | |
| mv "$DMG_FILE" artifacts/LinuxCommandLibrary-${VERSION}-macos.dmg | |
| # Rename MSI (find the actual file) | |
| MSI_FILE=$(find artifacts/msi -name "*.msi" | head -1) | |
| mv "$MSI_FILE" artifacts/LinuxCommandLibrary-${VERSION}-windows.msi | |
| # Rename DEB (find the actual file) | |
| DEB_FILE=$(find artifacts/deb -name "*.deb" | head -1) | |
| mv "$DEB_FILE" artifacts/LinuxCommandLibrary-${VERSION}-linux.deb | |
| - name: Create Github Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| - name: Upload APK to Github Release | |
| uses: actions/upload-release-asset@v1.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: artifacts/LinuxCommandLibrary-${{ env.VERSION }}-android.apk | |
| asset_name: LinuxCommandLibrary-${{ env.VERSION }}-android.apk | |
| asset_content_type: application/vnd.android.package-archive | |
| - name: Upload JAR to Github Release | |
| uses: actions/upload-release-asset@v1.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: artifacts/linuxcommandlibrary-${{ env.VERSION }}.jar | |
| asset_name: linuxcommandlibrary-${{ env.VERSION }}.jar | |
| asset_content_type: application/java-archive | |
| - name: Upload DMG to Github Release | |
| uses: actions/upload-release-asset@v1.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: artifacts/LinuxCommandLibrary-${{ env.VERSION }}-macos.dmg | |
| asset_name: LinuxCommandLibrary-${{ env.VERSION }}-macos.dmg | |
| asset_content_type: application/x-apple-diskimage | |
| - name: Upload MSI to Github Release | |
| uses: actions/upload-release-asset@v1.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: artifacts/LinuxCommandLibrary-${{ env.VERSION }}-windows.msi | |
| asset_name: LinuxCommandLibrary-${{ env.VERSION }}-windows.msi | |
| asset_content_type: application/x-msi | |
| - name: Upload DEB to Github Release | |
| uses: actions/upload-release-asset@v1.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: artifacts/LinuxCommandLibrary-${{ env.VERSION }}-linux.deb | |
| asset_name: LinuxCommandLibrary-${{ env.VERSION }}-linux.deb | |
| asset_content_type: application/vnd.debian.binary-package |