Skip to content

Commit

Permalink
optimized code
Browse files Browse the repository at this point in the history
  • Loading branch information
leavesCZY committed Jun 6, 2024
1 parent 07d3fa7 commit 31e1960
Show file tree
Hide file tree
Showing 18 changed files with 278 additions and 117 deletions.
174 changes: 174 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: create release

on:
push:
branches: [ master ]
paths:
- "**/workflows-trigger.properties"

jobs:

current-time:
runs-on: ubuntu-latest
name: get current time
outputs:
currentTime: ${{steps.currentTime.outputs.formattedTime}}
steps:
- id: currentTime
uses: josStorer/get-current-time@v2
with:
format: YYYY.MM.DD
utcOffset: "+08:00"

create-windows-package:
runs-on: windows-latest
name: create windows package
needs: current-time

steps:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: "18"
distribution: "oracle"
architecture: x64

- name: checkout
uses: actions/checkout@v4

- name: grant execute permission for gradlew
run: chmod +x gradlew

- name: assembleRelease
run: ./gradlew assembleRelease

- name: packageReleaseExe
run: ./gradlew packageReleaseExe

- name: packageReleaseMsi
run: ./gradlew packageReleaseMsi

- name: packageReleaseAppImage
run: ./gradlew packageReleaseAppImage

- name: rename File
run: |
mv ./composeApp/build/compose/binaries/main-release/msi/compose-multiplatform-tetris-1.0.0.msi ./composeApp/build/compose/binaries/main-release/msi/compose-multiplatform-tetris-windows-x64.msi
mv ./composeApp/build/compose/binaries/main-release/exe/compose-multiplatform-tetris-1.0.0.exe ./composeApp/build/compose/binaries/main-release/exe/compose-multiplatform-tetris-windows-x64.exe
- name: zip appImage
uses: thedoctor0/[email protected]
with:
type: "zip"
filename: "compose-multiplatform-tetris-windows-x64.zip"
directory: "./composeApp/build/compose/binaries/main-release/app"

- name: create a release
uses: ncipollo/release-action@v1
with:
artifacts: "**/compose-multiplatform-tetris-android.apk,**/compose-multiplatform-tetris-windows-x64.exe,**/compose-multiplatform-tetris-windows-x64.msi,**/compose-multiplatform-tetris-windows-x64.zip"
body: "create by workflows"
allowUpdates: true
artifactErrorsFailBuild: true
generateReleaseNotes: false
tag: ${{needs.current-time.outputs.currentTime}}
name: ${{needs.current-time.outputs.currentTime}}
token: ${{secrets.ACTION_TOKEN}}

create-macos-package:
strategy:
matrix:
os: [ macos-13, macos-14 ]
runs-on: ${{ matrix.os }}
name: create macos package
needs: current-time

steps:
- if: matrix.os == 'macos-13'
name: setup jdk
uses: actions/setup-java@v4
with:
java-version: "18"
distribution: "oracle"
architecture: x64

- if: matrix.os == 'macos-14'
name: setup jdk
uses: actions/setup-java@v4
with:
java-version: "18"
distribution: "oracle"
architecture: aarch64

- name: checkout
uses: actions/checkout@v4

- name: grant execute permission for gradlew
run: chmod +x gradlew

- name: packageReleaseDmg
run: ./gradlew packageReleaseDmg

- if: matrix.os == 'macos-13'
name: rename File
run: |
mv /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/dmg/compose-multiplatform-tetris-1.0.0.dmg /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/dmg/compose-multiplatform-tetris-macos-x64.dmg
- if: matrix.os == 'macos-14'
name: rename File
run: |
mv /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/dmg/compose-multiplatform-tetris-1.0.0.dmg /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/dmg/compose-multiplatform-tetris-macos-arm64.dmg
- name: create a release
uses: ncipollo/release-action@v1
with:
artifacts: "**/*.dmg"
body: "create by workflows"
allowUpdates: true
artifactErrorsFailBuild: true
generateReleaseNotes: false
tag: ${{needs.current-time.outputs.currentTime}}
name: ${{needs.current-time.outputs.currentTime}}
token: ${{secrets.ACTION_TOKEN}}

create-linux-package:
runs-on: ubuntu-latest
name: create linux package
needs: current-time

steps:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: "18"
distribution: "oracle"
architecture: x64

- name: checkout
uses: actions/checkout@v4

- name: grant execute permission for gradlew
run: chmod +x gradlew

- name: packageReleaseDeb
run: ./gradlew packageReleaseDeb

- name: packageReleaseRpm
run: ./gradlew packageReleaseRpm

- name: rename File
run: |
mv /home/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/deb/compose-multiplatform-tetris_1.0.0_amd64.deb /home/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/deb/compose-multiplatform-tetris-linux-amd64.deb
mv /home/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/rpm/compose-multiplatform-tetris-1.0.0-1.x86_64.rpm /home/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/rpm/compose-multiplatform-tetris-linux-x86_64.rpm
- name: create a release
uses: ncipollo/release-action@v1
with:
artifacts: "**/*.deb,**/*.rpm"
body: "create by workflows"
allowUpdates: true
artifactErrorsFailBuild: true
generateReleaseNotes: false
tag: ${{needs.current-time.outputs.currentTime}}
name: ${{needs.current-time.outputs.currentTime}}
token: ${{secrets.ACTION_TOKEN}}
51 changes: 0 additions & 51 deletions .github/workflows/package.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ captures
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
**/xcshareddata/WorkspaceSettings.xcsettings
/.kotlin/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# compose_tetris
# compose-multiplatform-tetris

不止 Android,Compose Multiplatform 实现 Android + Desktop 俄罗斯方块
compose multiplatform 实现一个 Android + windows + macOS + linux 俄罗斯方块

- [学不动也要学,Jetpack Compose 玩一把俄罗斯方块](https://juejin.cn/post/6974585048762679310)

Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ plugins {
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.jetbrains.kotlin.multiplatform).apply(false)
alias(libs.plugins.jetbrains.compose).apply(false)
alias(libs.plugins.jetbrains.compose.compiler).apply(false)
}
Loading

0 comments on commit 31e1960

Please sign in to comment.