name: Techmino CI on: push: branches: [main, ci*] tags: [pre*, v*] pull_request: branches: [main] env: BUILD_TYPE: ${{ fromJSON('["dev", "release"]')[startsWith(github.ref, 'refs/tags/v')] }} CORE_LOVE_PACKAGE_PATH: ./core.love CORE_LOVE_ARTIFACT_NAME: core_love_package jobs: get-info: runs-on: ubuntu-latest outputs: app-name: ${{ steps.app-info.outputs.app-name }} version-name: ${{ steps.app-info.outputs.version-name }} version-string: ${{ steps.app-info.outputs.version-string }} version-code: ${{ steps.app-info.outputs.version-code }} update-title: ${{ steps.app-info.outputs.update-title }} update-note: ${{ steps.app-info.outputs.update-note }} commit-hash: ${{ steps.git-info.outputs.commit-hash }} base-name: ${{ steps.assemble-base-name.outputs.base-name }} steps: - uses: actions/checkout@v3 - name: Install lua run: | sudo apt-get install lua5.3 -y - name: Get app info id: app-info shell: lua {0} run: | local version = require "version" os.execute('echo "app-name=Techmino" >> $GITHUB_OUTPUT') os.execute('echo "version-name=' .. version.name .. '" >> $GITHUB_OUTPUT') os.execute('echo "version-string=' .. version.string:gsub("%a", "") .. '" >> $GITHUB_OUTPUT') os.execute('echo "version-code=' .. tostring(version.code) .. '" >> $GITHUB_OUTPUT') local note = require 'parts.updateLog' local p1 = note:find("\n%d") + 1 local p2 = note:find("\n", p1) - 1 os.execute('echo "update-title=' .. note:sub(p1, p2) .. '" >> $GITHUB_OUTPUT') local p3 = note:find("\n", note:find("\n%d") + 1) + 1 local p4 = note:find("\n%d", p3 + 1) updateNote = note:sub(p3, p4 - 2) :gsub(" ", "- ") :gsub(" ", "# ") os.execute('echo "update-note<> $GITHUB_OUTPUT') os.execute('echo "' .. updateNote .. '" >> $GITHUB_OUTPUT') os.execute('echo "EOF" >> $GITHUB_OUTPUT') - name: Get git info id: git-info shell: bash run: | COMMIT_HASH=$(git rev-parse --short ${{ GITHUB.SHA }}) echo "commit-hash=$COMMIT_HASH" >> $GITHUB_OUTPUT - name: Assemble package base name id: assemble-base-name shell: bash run: | BASE_NAME=Techmino_${{ steps.app-info.outputs.version-string }}_${{ steps.git-info.outputs.commit-hash }}_#${{ GITHUB.RUN_NUMBER }} echo "base-name=$BASE_NAME" >> $GITHUB_OUTPUT build-core: runs-on: ubuntu-latest needs: get-info env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - uses: ./.github/actions/update-version if: ${{ !startsWith(github.ref, 'refs/tags/v') }} with: commit: ${{ needs.get-info.outputs.commit-hash }} type: snapshot - name: Build core love package uses: love-actions/love-actions-core@v1 with: build-list: ./media/ ./parts/ ./Zframework/ ./conf.lua ./main.lua ./version.lua package-path: ${{ env.CORE_LOVE_PACKAGE_PATH }} - name: Upload core love package uses: actions/upload-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} path: ${{ env.CORE_LOVE_PACKAGE_PATH }} - name: Rename love package run: | mkdir -p ${{ env.OUTPUT_FOLDER }} mv ${{ env.CORE_LOVE_PACKAGE_PATH }} ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love - name: Upload artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_Core_love path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Upload to WeTransfer id: transfer run: | curl -sL https://git.io/file-transfer | sh ./transfer wet -s -p 16 --no-progress ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love 2>&1>./wetransfer.log echo "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT auto-test: runs-on: ubuntu-latest needs: build-core steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Love actions for testing uses: love-actions/love-actions-test@v1 with: font-path: ./parts/fonts/proportional.otf language-folder: ./parts/language build-android: runs-on: ubuntu-latest needs: [get-info, build-core, auto-test] env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: if "${{ env.BUILD_TYPE }}" == "dev": f.write('bundle-id=org.f26_studio.' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '.snapshot\n') f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '_Snapshot\n') else: f.write('bundle-id=org.f26_studio.' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - name: Download core love package uses: actions/download-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Download ColdClear uses: ./.github/actions/get-cc with: platform: Android dir: ./ColdClear - name: Process ColdClear shell: bash run: | mkdir -p ./libAndroid/armeabi-v7a/ mkdir -p ./libAndroid/arm64-v8a/ mv ./ColdClear/armeabi-v7a/libCCloader.so ./libAndroid/armeabi-v7a/ mv ./ColdClear/arm64-v8a/libCCloader.so ./libAndroid/arm64-v8a/ - name: Build Android packages id: build-packages uses: love-actions/love-actions-android@v1 with: app-name: ${{ needs.get-info.outputs.app-name }} bundle-id: ${{ steps.process-app-name.outputs.bundle-id }} icon-specifier: "@mipmap/icon" keystore-alias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} keystore-base64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} keystore-key-password: ${{ secrets.ANDROID_KEYSTORE_KEYPASSWORD }} keystore-store-password: ${{ secrets.ANDROID_KEYSTORE_STOREPASSWORD }} love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} resource-path: ./.github/build/android/${{ env.BUILD_TYPE }}/res libs-path: ./ColdClear/ extra-assets: ./libAndroid/ product-name: ${{ steps.process-app-name.outputs.product-name }} version-string: ${{ needs.get-info.outputs.version-string }} version-code: ${{ needs.get-info.outputs.version-code }} output-folder: ${{ env.OUTPUT_FOLDER }} - name: Upload artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_Android_release path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}-release.apk - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}-release.apk ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Android.apk - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Android.apk body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Upload to WeTransfer id: transfer run: | curl -sL https://git.io/file-transfer | sh ./transfer wet -s -p 16 --no-progress ${{ steps.build-packages.outputs.package-paths }} 2>&1>./wetransfer.log echo "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT build-ios: runs-on: macos-latest if: github.event_name != 'pull_request' needs: [get-info, build-core, auto-test] env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: f.write('bundle-id=org.26f-studio.techmino\n') f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - name: Download core love package uses: actions/download-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Download ColdClear uses: ./.github/actions/get-cc with: platform: iOS dir: ./ColdClear - name: Build iOS packages id: build-packages uses: love-actions/love-actions-ios@v1 with: app-name: ${{ needs.get-info.outputs.app-name }} bundle-id: ${{ steps.process-app-name.outputs.bundle-id }} copyright: "Copyright © 2019-2022 26F-Studio. Some Rights Reserved." icon-path: ./.github/build/iOS/${{ env.BUILD_TYPE }}/icon love-patch: ./.github/build/iOS/love.patch love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} libs-path: ./ColdClear/arm64/ product-name: ${{ steps.process-app-name.outputs.product-name }} version-string: ${{ needs.get-info.outputs.version-string }} output-folder: ${{ env.OUTPUT_FOLDER }} apple-development-base64: ${{ secrets.APPLE_CERT_APPLE_DEVELOPMENT_BASE64 }} apple-development-password: ${{ secrets.APPLE_CERT_APPLE_DEVELOPMENT_PWD }} api-key: ${{ secrets.APPLE_API_KEY }} api-key-id: ${{ secrets.APPLE_API_KEY_ID }} api-issuer-id: ${{ secrets.APPLE_API_ISSUER_ID }} team-id: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }} apple-id: ${{ secrets.APPLE_APPLE_ID }} external-test: ${{ startsWith(github.ref, 'refs/tags/pre') }} store-release: ${{ startsWith(github.ref, 'refs/tags/v') }} - name: Upload logs artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_iOS_logs path: | ${{ env.OUTPUT_FOLDER }}/DistributionSummary.plist ${{ env.OUTPUT_FOLDER }}/ExportOptions.plist ${{ env.OUTPUT_FOLDER }}/Packaging.log - name: Upload ipa artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_iOS_ipa path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.ipa - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.ipa ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_iOS.ipa - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_iOS.ipa body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Upload to WeTransfer id: transfer run: | wget -qO- https://github.com/Mikubill/transfer/releases/download/v0.4.17/transfer_0.4.17_darwin_amd64.tar.gz | tar xvz ./transfer wet -s -p 16 --no-progress ${{ steps.build-packages.outputs.package-paths }} 2>&1>./wetransfer.log echo "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT build-linux: runs-on: ubuntu-latest needs: [get-info, build-core, auto-test] env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - name: Download core love package uses: actions/download-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Download ColdClear uses: ./.github/actions/get-cc with: platform: Linux dir: ./ColdClear - name: Process ColdClear shell: bash run: | cd ./ColdClear mkdir ./libs mv ./x64/libcold_clear.so ./libs mkdir ./shared mv ./x64/CCloader.so ./shared - name: Build Linux packages id: build-packages uses: love-actions/love-actions-linux@v1 with: desktop-file-path: ./.github/build/linux/${{ env.BUILD_TYPE }}/template.desktop executable-name: app icon-path: ./.github/build/linux/${{ env.BUILD_TYPE }}/icon.png love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} libs-path: ./ColdClear/libs/ shared-path: ./ColdClear/shared/ product-name: ${{ steps.process-app-name.outputs.product-name }} output-folder: ${{ env.OUTPUT_FOLDER }} - name: Upload AppImage artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_Linux_AppImage path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Upload to WeTransfer id: transfer run: | curl -sL https://git.io/file-transfer | sh ./transfer wet -s -p 16 --no-progress ${{ steps.build-packages.outputs.package-paths }} 2>&1>./wetransfer.log echo "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT build-macos-appstore: runs-on: macos-latest if: github.event_name != 'pull_request' needs: [get-info, build-core, auto-test] env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: f.write('bundle-id=org.26f-studio.techmino\n') f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - name: Download core love package uses: actions/download-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Download ColdClear uses: ./.github/actions/get-cc with: platform: macOS dir: ./ColdClear - name: Process ColdClear shell: bash run: | rm ./ColdClear/universal/libcold_clear.a - name: Build macOS packages id: build-packages uses: love-actions/love-actions-macos-appstore@v1 with: app-name: ${{ needs.get-info.outputs.app-name }} bundle-id: ${{ steps.process-app-name.outputs.bundle-id }} copyright: "Copyright © 2019-2022 26F-Studio. Some Rights Reserved." icon-path: ./.github/build/macOS/${{ env.BUILD_TYPE }}/icon.icns love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} libs-path: ./ColdClear/universal/ product-name: ${{ steps.process-app-name.outputs.product-name }} version-string: ${{ needs.get-info.outputs.version-string }} output-folder: ${{ env.OUTPUT_FOLDER }} apple-development-base64: ${{ secrets.APPLE_CERT_APPLE_DEVELOPMENT_BASE64 }} apple-development-password: ${{ secrets.APPLE_CERT_APPLE_DEVELOPMENT_PWD }} api-key: ${{ secrets.APPLE_API_KEY }} api-key-id: ${{ secrets.APPLE_API_KEY_ID }} api-issuer-id: ${{ secrets.APPLE_API_ISSUER_ID }} team-id: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }} apple-id: ${{ secrets.APPLE_APPLE_ID }} external-test: ${{ startsWith(github.ref, 'refs/tags/pre') }} store-release: ${{ startsWith(github.ref, 'refs/tags/v') }} - name: Upload logs artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_macOS_appstore_logs path: | ${{ env.OUTPUT_FOLDER }}/DistributionSummary.plist ${{ env.OUTPUT_FOLDER }}/ExportOptions.plist ${{ env.OUTPUT_FOLDER }}/Packaging.log - name: Upload pkg artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_macOS_appstore_pkg path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.pkg - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.pkg ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_macOS_appstore.pkg - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_macOS_appstore.pkg body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Upload to WeTransfer id: transfer run: | wget -qO- https://github.com/Mikubill/transfer/releases/download/v0.4.17/transfer_0.4.17_darwin_amd64.tar.gz | tar xvz ./transfer wet -s -p 16 --no-progress ${{ steps.build-packages.outputs.package-paths }} 2>&1>./wetransfer.log echo "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT build-macos-portable: runs-on: macos-latest if: github.event_name != 'pull_request' needs: [get-info, build-core, auto-test] env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: f.write('bundle-id=org.26f-studio.techmino\n') f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - name: Download core love package uses: actions/download-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Download ColdClear uses: ./.github/actions/get-cc with: platform: macOS dir: ./ColdClear - name: Process ColdClear shell: bash run: | rm ./ColdClear/universal/libcold_clear.a - name: Build macOS packages id: build-packages uses: love-actions/love-actions-macos-portable@v1 with: app-name: ${{ needs.get-info.outputs.app-name }} bundle-id: ${{ steps.process-app-name.outputs.bundle-id }} copyright: "Copyright © 2019-2022 26F-Studio. Some Rights Reserved." icon-path: ./.github/build/macOS/${{ env.BUILD_TYPE }}/icon.icns love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} libs-path: ./ColdClear/universal/ product-name: ${{ steps.process-app-name.outputs.product-name }} version-string: ${{ needs.get-info.outputs.version-string }} output-folder: ${{ env.OUTPUT_FOLDER }} account-username: ${{ secrets.APPLE_ACCOUNT_USERNAME }} account-password: ${{ secrets.APPLE_ACCOUNT_PASSWORD }} team-id: "${{ secrets.APPLE_DEVELOPER_TEAM_ID }}" developer-id-application-base64: ${{ secrets.APPLE_CERT_DEVELOPER_ID_APPLICATION }} developer-id-application-password: ${{ secrets.APPLE_CERT_DEVELOPER_ID_APPLICATION_PWD }} developer-id-installer-base64: ${{ secrets.APPLE_CERT_DEVELOPER_ID_INSTALLER }} developer-id-installer-password: ${{ secrets.APPLE_CERT_DEVELOPER_ID_INSTALLER_PWD }} dmg-background-path: ./.github/build/macOS/${{ env.BUILD_TYPE }}/dmg.png dmg-icon-position: "239 203" dmg-icon-size: "100" dmg-link-position: "565 203" dmg-text-size: "12" dmg-volume-icon-path: ./.github/build/macOS/${{ env.BUILD_TYPE }}/dmg.icns dmg-volume-name: ${{ steps.process-app-name.outputs.product-name }} dmg-window-position: "200 120" dmg-window-size: "800 500" - name: Upload pkg artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_macOS_portable_pkg path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.pkg - name: Upload dmg artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_macOS_portable_dmg path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.dmg - name: Upload bare artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_macOS_portable_bare path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.zip - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.pkg ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_macOS_portable.pkg cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.dmg ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_macOS_portable.dmg - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_macOS_portable.pkg, ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_macOS_portable.dmg body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Upload to WeTransfer id: transfer run: | wget -qO- https://github.com/Mikubill/transfer/releases/download/v0.4.17/transfer_0.4.17_darwin_amd64.tar.gz | tar xvz ./transfer wet -s -p 16 --no-progress ${{ steps.build-packages.outputs.package-paths }} 2>&1>./wetransfer.log echo "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT build-windows: runs-on: windows-latest needs: [get-info, build-core, auto-test] env: OUTPUT_FOLDER: ./build RELEASE_FOLDER: ./release outputs: download-url: ${{ steps.transfer.outputs.download-url }} steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Process app name id: process-app-name shell: python3 {0} run: | import os import re with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') - name: Download core love package uses: actions/download-artifact@v3 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Download ColdClear uses: ./.github/actions/get-cc with: platform: Windows dir: ./ColdClear - name: Build Windows packages id: build-packages uses: love-actions/love-actions-windows@v1 with: icon-path: ./.github/build/windows/${{ env.BUILD_TYPE }}/icon.ico rc-path: ./.github/build/windows/${{ env.BUILD_TYPE }}/template.rc love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} extra-assets-x86: ./ColdClear/x86/CCloader.dll ./ColdClear/x86/cold_clear.dll extra-assets-x64: ./ColdClear/x64/CCloader.dll ./ColdClear/x64/cold_clear.dll product-name: ${{ steps.process-app-name.outputs.product-name }} version-string: ${{ needs.get-info.outputs.version-string }} output-folder: ${{ env.OUTPUT_FOLDER }} - name: Upload 32-bit artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_Windows_x86 path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip - name: Upload 64-bit artifact uses: actions/upload-artifact@v3 with: name: ${{ needs.get-info.outputs.base-name }}_Windows_x64 path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip - name: Prepare for release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} shell: bash run: | mkdir -p ${{ env.RELEASE_FOLDER }} cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip - name: Upload release if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip, ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip body: ${{ needs.get-info.outputs.update-note }} name: ${{ needs.get-info.outputs.update-title }} prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} - name: Get transfer env: TEMP_PATH: ./temp.zip shell: bash run: | curl -L --retry 5 https://github.com/Mikubill/transfer/releases/download/v0.4.17/transfer_0.4.17_windows_amd64.zip -o ${{ env.TEMP_PATH }} 7z x ${{ env.TEMP_PATH }} -o./ rm ${{ env.TEMP_PATH }} - name: Upload to WeTransfer id: transfer shell: pwsh run: | ./transfer.exe wet -s -p 16 --no-progress ${{ steps.build-packages.outputs.package-paths }} 2>&1>./wetransfer.log "download-url=$(cat ./wetransfer.log | grep https | cut -f3 -d" ")" >> $env:GITHUB_OUTPUT post-build: runs-on: ubuntu-latest if: ${{ always() }} needs: [ get-info, auto-test, build-core, build-android, build-ios, build-linux, build-macos-appstore, build-macos-portable, build-windows, ] env: ACTION_TYPE: ${{ fromJSON('[["Development", "Pre-release"], ["Release", "Release"]]')[startsWith(github.ref, 'refs/tags/v')][startsWith(github.ref, 'refs/tags/pre')] }} steps: - uses: actions/checkout@v3 - name: Cleanup uses: geekyeggo/delete-artifact@v2 with: name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} - name: Display summary shell: bash run: | echo "# Summary" >> $GITHUB_STEP_SUMMARY echo "## Version: ${{ needs.get-info.outputs.version-string }}" >> $GITHUB_STEP_SUMMARY echo "## Package Name: ${{ needs.get-info.outputs.base-name }}" >> $GITHUB_STEP_SUMMARY echo "## Download links: " >> $GITHUB_STEP_SUMMARY - name: Display download links shell: python3 {0} run: | import os with open(os.getenv('GITHUB_STEP_SUMMARY'), 'a') as f: if "${{ needs.build-core.result }}" == "success": f.write("- Bare love packages: [WeTransfer](${{ needs.build-core.outputs.download-url }})\n") if "${{ needs.build-android.result }}" == "success": f.write("- Android packages: [WeTransfer](${{ needs.build-android.outputs.download-url }})\n") if "${{ needs.build-ios.result }}" == "success": f.write("- iOS packages: [WeTransfer](${{ needs.build-ios.outputs.download-url }})\n") if "${{ needs.build-linux.result }}" == "success": f.write("- Linux packages: [WeTransfer](${{ needs.build-linux.outputs.download-url }})\n") if "${{ needs.build-macos-appstore.result }}" == "success": f.write("- macOS packages(App Store version): [WeTransfer](${{ needs.build-macos-appstore.outputs.download-url }})\n") if "${{ needs.build-macos-portable.result }}" == "success": f.write("- macOS packages(Portable version): [WeTransfer](${{ needs.build-macos-portable.outputs.download-url }})\n") if "${{ needs.build-windows.result }}" == "success": f.write("- Windows packages: [WeTransfer](${{ needs.build-windows.outputs.download-url }})\n") - name: Send Discord message uses: Sniddl/discord-commits@v1.5 with: webhook: ${{ secrets.DISCORD_WEBHOOK }} message: "Github Actions for **${{ github.repository }}**." embed: '{ "author":{ "name":"${{ needs.get-info.outputs.app-name }} [${{ env.ACTION_TYPE }}]", "url":"https://github.com/${{ github.repository }}" }, "title":"${{ needs.get-info.outputs.app-name }} (${{ needs.get-info.outputs.version-name }}) Build Result", "description": "CI triggered at ${{ needs.get-info.outputs.commit-hash }}", "url":"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "thumbnail":{ "url":"https://raw.githubusercontent.com/${{ github.repository }}/main/.github/build/linux/${{ env.BUILD_TYPE }}/icon.png" }, "color":36863, "fields":[ {"name":"Version","value":"${{ needs.get-info.outputs.version-string }}","inline": true}, {"name":"Package Name","value":"${{ needs.get-info.outputs.base-name }}","inline": true}, {"name":"Status","value":"**Automatic Test:** ${{ needs.auto-test.result }}\n**Core:** ${{ needs.build-core.result }}\n**Android:** ${{ needs.build-android.result }}\n**iOS:** ${{ needs.build-ios.result }}\n**Linux:** ${{ needs.build-linux.result }}\n**macOS App Store:** ${{ needs.build-macos-appstore.result }}\n**macOS portable:** ${{ needs.build-macos-portable.result }}\n**Windows:** ${{ needs.build-windows.result }}"}, {"name":"Download Links","value":"**Core:** ${{ needs.build-core.outputs.download-url}}\n**Android:** ${{ needs.build-android.outputs.download-url }}\n**iOS:** ${{ needs.build-ios.outputs.download-url }}\n**Linux:** ${{ needs.build-linux.outputs.download-url }}\n**macOS App Store:** ${{ needs.build-macos-appstore.outputs.download-url }}\n**macOS portable:** ${{ needs.build-macos-portable.outputs.download-url }}\n**Windows:** ${{ needs.build-windows.outputs.download-url}}"} ] }'