📝 Define the Clipboard Collection and Clip Item concepts and mod… #21
Workflow file for this run
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: "Build Package" | |
on: | |
push: | |
tags: | |
- 'v-*-beta*' | |
jobs: | |
check-dylib-cache: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-hit-x86: ${{ steps.cache-check-x86.outputs.cache-hit }} | |
cache-hit-aarch64: ${{ steps.cache-check-aarch64.outputs.cache-hit }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: check-dylib-cache-x86 | |
id: cache-check-x86 | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./composeApp/dylib/darwin-x86-64/libMacosApi.dylib | |
key: mac-dylib-darwin-x86-64-${{ hashFiles('**/*.swift', '**/dylib-mini-sys.properties') }} | |
enableCrossOsArchive: true | |
- name: check-dylib-cache-aarch64 | |
id: cache-check-aarch64 | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./composeApp/dylib/darwin-aarch64/libMacosApi.dylib | |
key: mac-dylib-darwin-aarch64-${{ hashFiles('**/*.swift', '**/dylib-mini-sys.properties') }} | |
enableCrossOsArchive: true | |
build-macos: | |
needs: check-dylib-cache | |
runs-on: macos-latest | |
if: needs.check-dylib-cache.outputs.cache-hit-x86 != 'true' && needs.check-dylib-cache.outputs.cache-hit-aarch64 != 'true' | |
strategy: | |
matrix: | |
arch: | |
- x86_64-apple-macos10.15 | |
- arm64-apple-macos11 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Swift environment | |
run: brew install swift | |
- name: Build dylib | |
working-directory: ${{ github.workspace }} | |
run: | | |
ARCH_DIR=${{ matrix.arch }} | |
if [[ "$ARCH_DIR" == *"arm64"* ]]; then | |
LIB_DIR="darwin-aarch64" | |
else | |
LIB_DIR="darwin-x86-64" | |
fi | |
mkdir -p ${{ github.workspace }}/composeApp/dylib/$LIB_DIR | |
swiftc -emit-library composeApp/src/desktopMain/swift/MacosApi.swift -target ${{ matrix.arch }} -o ${{ github.workspace }}/composeApp/dylib/$LIB_DIR/libMacosApi.dylib | |
echo "PREFIX=$LIB_DIR" >> $GITHUB_ENV | |
- name: Save dylib to cache | |
id: cache-dylib-save | |
uses: actions/cache/save@v4 | |
with: | |
path: ./composeApp/dylib/${{ env.PREFIX }}/libMacosApi.dylib | |
key: mac-dylib-${{ env.PREFIX }}-${{ hashFiles('**/*.swift', '**/dylib-mini-sys.properties') }} | |
enableCrossOsArchive: true | |
build-ubuntu: | |
needs: [check-dylib-cache, build-macos] | |
runs-on: ubuntu-latest | |
if: ${{ !cancelled() && (success() || needs.build-macos.result == 'skipped') }} | |
env: | |
BUILD_FULL_PLATFORM: YES | |
BUILD_MAIN_PATH: ${{ github.workspace }}/composeApp/build/classes/kotlin/desktop/main | |
APPLE_ASP: ${{ secrets.APPLE_ASP }} | |
MAC_SIGNING_KEY_FILE_PATH: ${{ github.workspace }}/developerID_application.p12 | |
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/actions/runner-images/issues/2840 | |
- name: Clear unnecessary files to free up space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: check version properties | |
id: versioning | |
run: | | |
TAG_NAME=${GITHUB_REF/refs\/tags\//} | |
echo "Full tag: $TAG_NAME" | |
TAG_VERSION=$(echo $TAG_NAME | sed -E 's/v-([0-9]+\.[0-9]+\.[0-9]+)-beta([0-9]+)/\1/') | |
BETA=$(echo $TAG_NAME | sed -E 's/v-([0-9]+\.[0-9]+\.[0-9]+)-beta([0-9]+)/\2/') | |
echo "Tag Version: $TAG_VERSION" | |
echo "Tag Beta: $BETA" | |
PROPERTIES_VERSION=$(grep 'version=' ${{ github.workspace }}/composeApp/src/desktopMain/resources/version.properties | cut -d'=' -f2) | |
echo "Properties Version: $PROPERTIES_VERSION" | |
if [ "$TAG_VERSION" != "$PROPERTIES_VERSION" ]; then | |
echo "Error: Tag version does not match properties version." | |
exit 1 | |
else | |
echo "Versions match. Proceeding to update beta value in properties file." | |
echo -e "\nbeta=$BETA" >> ${{ github.workspace }}/composeApp/src/desktopMain/resources/version.properties | |
echo "Beta value added to properties file." | |
fi | |
echo "VERSION=PROPERTIES_VERSION" >> $GITHUB_ENV | |
echo "BETA=$BETA" >> $GITHUB_ENV | |
PACKAGE_VERSION="${PROPERTIES_VERSION}-beta${BETA}" | |
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: true | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
./composeApp/resources | |
./composeApp/jbr | |
key: > | |
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', | |
'**/gradle-wrapper.properties', '**/libs.versions.toml', | |
'**/webDriver.properties', '**/jbr.yaml') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
enableCrossOsArchive: true | |
- name: check-darwin-x86-64-dylib-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./composeApp/dylib/darwin-x86-64/libMacosApi.dylib | |
key: mac-dylib-darwin-x86-64-${{ hashFiles('**/*.swift', '**/dylib-mini-sys.properties') }} | |
enableCrossOsArchive: true | |
- name: check-darwin-aarch64-dylib-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./composeApp/dylib/darwin-aarch64/libMacosApi.dylib | |
key: mac-dylib-darwin-aarch64-${{ hashFiles('**/*.swift', '**/dylib-mini-sys.properties') }} | |
enableCrossOsArchive: true | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Prepare Conveyor | |
run: | | |
echo "${{ secrets.DEVELOPER_ID_APPLICATION }}" | base64 --decode > developerID_application.p12 | |
- name: Conveyor build Windows app | |
uses: hydraulic-software/conveyor/actions/[email protected] | |
with: | |
command: make windows-zip --output-dir=./output/clipevery-windows-${{ env.PACKAGE_VERSION }} | |
extra_flags: -f ci.conveyor.conf | |
signing_key: ${{ secrets.SIGNING_KEY }} | |
agree_to_license: 1 | |
- name: Upload Windows app | |
id: upload_window_app | |
uses: JohnGuan/oss-upload-action@main | |
with: | |
key-id: ${{ secrets.ALIYUN_ACCESSKEY_ID }} | |
key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }} | |
region: oss-cn-shenzhen | |
bucket: clipevery-desktop | |
assets: output/clipevery-windows-${{ env.PACKAGE_VERSION }}/**:/${{ env.PACKAGE_VERSION }}/ | |
- name: Conveyor build Mac amd64 app | |
uses: hydraulic-software/conveyor/actions/[email protected] | |
with: | |
command: make mac-app --output-dir=./output/clipevery-mac-adm64-${{ env.PACKAGE_VERSION }} | |
extra_flags: -f ci.conveyor.conf -Kapp.machines=mac.amd64 | |
signing_key: ${{ secrets.SIGNING_KEY }} | |
agree_to_license: 1 | |
# Preserve the file permissions of Clipevery.app | |
# directly use upload-artifact to compress zip and lose file permissions | |
# https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss | |
- name: Tar Mac amd64 app | |
run: tar -cvf output/clipevery-mac-adm64-${{ env.PACKAGE_VERSION }}/clipevery-mac-adm64-${{ env.PACKAGE_VERSION }}.tar -C output/clipevery-mac-adm64-${{ env.PACKAGE_VERSION }} Clipevery.app | |
- name: Upload Mac amd64 app | |
id: upload_mac_adm64_app | |
uses: JohnGuan/oss-upload-action@main | |
with: | |
key-id: ${{ secrets.ALIYUN_ACCESSKEY_ID }} | |
key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }} | |
region: oss-cn-shenzhen | |
bucket: clipevery-desktop | |
assets: output/clipevery-mac-adm64-${{ env.PACKAGE_VERSION }}/clipevery-mac-adm64-${{ env.PACKAGE_VERSION }}.tar:/${{ env.PACKAGE_VERSION }}/ | |
- name: Conveyor build Mac aarch64 app | |
uses: hydraulic-software/conveyor/actions/[email protected] | |
with: | |
command: make mac-app --output-dir=./output/clipevery-mac-aarch64-${{ env.PACKAGE_VERSION }} | |
extra_flags: -f ci.conveyor.conf -Kapp.machines=mac.aarch64 | |
signing_key: ${{ secrets.SIGNING_KEY }} | |
agree_to_license: 1 | |
- name: Tar Mac aarch64 app | |
run: tar -cvf output/clipevery-mac-aarch64-${{ env.PACKAGE_VERSION }}/clipevery-mac-aarch64-${{ env.PACKAGE_VERSION }}.tar -C output/clipevery-mac-aarch64-${{ env.PACKAGE_VERSION }} Clipevery.app | |
- name: Upload Mac aaarch64 app | |
id: upload_mac_aarch64_app | |
uses: JohnGuan/oss-upload-action@main | |
with: | |
key-id: ${{ secrets.ALIYUN_ACCESSKEY_ID }} | |
key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }} | |
region: oss-cn-shenzhen | |
bucket: clipevery-desktop | |
assets: output/clipevery-mac-aarch64-${{ env.PACKAGE_VERSION }}/clipevery-mac-aarch64-${{ env.PACKAGE_VERSION }}.tar:/${{ env.PACKAGE_VERSION }}/ | |
- name: Conveyor build Linux app | |
uses: hydraulic-software/conveyor/actions/[email protected] | |
with: | |
command: make debian-package --output-dir=./output/clipevery-linux-${{ env.PACKAGE_VERSION }} | |
extra_flags: -f ci.conveyor.conf | |
signing_key: ${{ secrets.SIGNING_KEY }} | |
agree_to_license: 1 | |
- name: Upload Linux app | |
id: upload_linux_app | |
uses: JohnGuan/oss-upload-action@main | |
with: | |
key-id: ${{ secrets.ALIYUN_ACCESSKEY_ID }} | |
key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }} | |
region: oss-cn-shenzhen | |
bucket: clipevery-desktop | |
assets: output/clipevery-linux-${{ env.PACKAGE_VERSION }}/**:/${{ env.PACKAGE_VERSION }}/ | |
# conveyor default cache directory is .conveyor/cache | |
# Avoid caching it, causing Github space payment | |
- name: Cleanup Conveyor | |
if: always() | |
run: | | |
rm -f developerID_application.p12 | |
rm -rf .conveyor/cache/* | |
- name: Display file tree with sizes | |
run: | | |
echo "Displaying the size of files and directories in 'output' directory:" | |
du -ah output | sort -rh | |
# delete output directory to free up space, Github Action only has 14G space, | |
# to avoid the failure of insufficient space in the subsequent post recycling steps | |
- name: Delete output directory | |
run: rm -rf output |