|
| 1 | +name: CICD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +permissions: |
| 7 | + pages: write |
| 8 | + id-token: write |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + build_android: |
| 13 | + name: Build Android APK |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up JDK 21 |
| 20 | + uses: actions/setup-java@v4 |
| 21 | + with: |
| 22 | + distribution: 'temurin' |
| 23 | + java-version: '21' |
| 24 | + cache: gradle |
| 25 | + |
| 26 | + - name: Setup Gradle |
| 27 | + uses: gradle/actions/setup-gradle@v4 |
| 28 | + |
| 29 | + - name: Build Android APK (Release) |
| 30 | + run: ./gradlew :composeApp:assembleRelease |
| 31 | + |
| 32 | + - name: Upload Android APK |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: android-apk |
| 36 | + path: composeApp/build/outputs/apk/release/composeApp-release.apk |
| 37 | + if-no-files-found: error |
| 38 | + |
| 39 | + build_wasm: |
| 40 | + name: Build Wasm |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - name: Checkout repository |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Set up JDK 21 |
| 47 | + uses: actions/setup-java@v4 |
| 48 | + with: |
| 49 | + distribution: 'temurin' |
| 50 | + java-version: '21' |
| 51 | + cache: gradle |
| 52 | + |
| 53 | + - name: Setup Gradle |
| 54 | + uses: gradle/actions/setup-gradle@v4 |
| 55 | + |
| 56 | + - name: Build Wasm |
| 57 | + run: ./gradlew :composeApp:wasmJsBrowserDistribution |
| 58 | + |
| 59 | + - name: Upload Wasm Artifacts |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: wasm |
| 63 | + path: composeApp/build/dist/wasmJs/productionExecutable/ |
| 64 | + if-no-files-found: error |
| 65 | + |
| 66 | + - name: Upload pages artifact |
| 67 | + id: deployment |
| 68 | + uses: actions/upload-pages-artifact@v3 |
| 69 | + with: |
| 70 | + path: composeApp/build/dist/wasmJs/productionExecutable/ |
| 71 | + |
| 72 | + deploy_wasm: |
| 73 | + name: Deploy Wasm |
| 74 | + environment: |
| 75 | + name: github-pages |
| 76 | + url: ${{ steps.deployment.outputs.page_url }} |
| 77 | + runs-on: ubuntu-latest |
| 78 | + needs: build_wasm |
| 79 | + steps: |
| 80 | + - name: Deploy to GitHub Pages |
| 81 | + id: deployment |
| 82 | + uses: actions/deploy-pages@v4 |
| 83 | + |
| 84 | + build_desktop: |
| 85 | + name: Build on ${{ matrix.os }} |
| 86 | + strategy: |
| 87 | + matrix: |
| 88 | + include: |
| 89 | + - os: windows-latest |
| 90 | + ext: msi |
| 91 | + - os: macos-latest |
| 92 | + ext: dmg |
| 93 | + - os: ubuntu-latest |
| 94 | + ext: deb |
| 95 | + runs-on: ${{ matrix.os }} |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Checkout repository |
| 99 | + uses: actions/checkout@v4 |
| 100 | + |
| 101 | + - name: Set up JDK 21 |
| 102 | + uses: actions/setup-java@v4 |
| 103 | + with: |
| 104 | + distribution: 'temurin' |
| 105 | + java-version: '21' |
| 106 | + cache: gradle |
| 107 | + |
| 108 | + - name: Setup Gradle |
| 109 | + uses: gradle/actions/setup-gradle@v4 |
| 110 | + |
| 111 | + - name: Build Desktop Package |
| 112 | + run: ./gradlew :composeApp:packageDistributionForCurrentOS |
| 113 | + shell: bash |
| 114 | + |
| 115 | + - name: Upload Desktop Artifacts |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: kocoboy-${{ matrix.os }}.${{ matrix.ext }} |
| 119 | + path: composeApp/build/compose/binaries/main/${{ matrix.ext }}/*.${{ matrix.ext }} |
| 120 | + if-no-files-found: ignore |
| 121 | + |
| 122 | + release: |
| 123 | + name: Create GitHub Release |
| 124 | + runs-on: ubuntu-latest |
| 125 | + needs: [ build_android, build_wasm, build_desktop ] |
| 126 | + steps: |
| 127 | + - name: Download all artifacts |
| 128 | + uses: actions/download-artifact@v4 |
| 129 | + |
| 130 | + - name: Create Release and Upload Artifacts |
| 131 | + uses: softprops/action-gh-release@v2 |
| 132 | + with: |
| 133 | + files: | |
| 134 | + android-apk/composeApp-release.apk |
| 135 | + wasm/** |
| 136 | + kocoboy-windows-latest.msi/* |
| 137 | + kocoboy-macos-latest.dmg/* |
| 138 | + kocoboy-ubuntu-latest.deb/* |
| 139 | +
|
0 commit comments