Skip to content

optimized code

optimized code #13

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-release-distribution:
strategy:
matrix:
os: [ windows-latest , ubuntu-latest , macos-13 , macos-14 ]
runs-on: ${{ matrix.os }}
name: create release distribution
needs: current-time
steps:
- if: matrix.os != 'macos-14'
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
- if: matrix.os == 'windows-latest'
name: assembleRelease
run: ./gradlew assembleRelease
- name: packageReleaseDistributionForCurrentOS
run: ./gradlew packageReleaseDistributionForCurrentOS
- if: matrix.os == 'windows-latest'
name: rename File
run: |
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
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
- if: matrix.os == 'windows-latest'
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"
- if: matrix.os == 'ubuntu-latest'
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
- 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
mv /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/pkg/compose-multiplatform-tetris-1.0.0.pkg /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/pkg/compose-multiplatform-tetris-macos-x64.pkg
- 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
mv /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/pkg/compose-multiplatform-tetris-1.0.0.pkg /Users/runner/work/compose-multiplatform-tetris/compose-multiplatform-tetris/composeApp/build/compose/binaries/main-release/pkg/compose-multiplatform-tetris-macos-arm64.pkg
- name: create a release
uses: ncipollo/release-action@v1
with:
artifacts: "**/*.apk,**/*.exe,**/*.msi,**/compose-multiplatform-tetris-windows-x64.zip,**/*.deb,**/*.rpm,**/*.dmg,**/*.pkg"
body: "create by workflows"
allowUpdates: true
artifactErrorsFailBuild: false
generateReleaseNotes: false
tag: ${{needs.current-time.outputs.currentTime}}
name: ${{needs.current-time.outputs.currentTime}}
token: ${{secrets.ACTION_TOKEN}}