Skip to content

Setup publication for android #3

Setup publication for android

Setup publication for android #3

Workflow file for this run

# This file was generated using Kotlin DSL (.github/workflows/src.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/typesafegithub/github-workflows-kt
name: 'Release'
on:
push:
tags:
- 'v*'
permissions:
actions: 'write'
contents: 'write'
jobs:
create-release:
name: 'Create Release'
runs-on: 'ubuntu-latest'
outputs:
uploadUrl: '${{ steps.step-4.outputs.upload_url }}'
id: '${{ steps.step-4.outputs.id }}'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Get Tag'
uses: 'dawidd6/action-get-tag@v1'
- id: 'step-2'
uses: 'bhowell2/github-substring-action@v1.0.0'
with:
value: '${{ steps.step-1.outputs.tag }}'
index_of_str: 'v'
default_return_value: '${{ steps.step-1.outputs.tag }}'
- id: 'step-3'
name: 'Generate Release Notes'
run: |-
# Specify the file path
FILE_PATH="ci-helper/release-template.md"
# Read the file content
file_content=$(cat "$FILE_PATH")
modified_content="$file_content"
# Replace 'string_to_find' with 'string_to_replace_with' in the content
modified_content="${modified_content//\$GIT_TAG/${{ steps.step-1.outputs.tag }}}"
modified_content="${modified_content//\$TAG_VERSION/${{ steps.step-2.outputs.substring }}}"
# Output the result as a step output
echo "result<<EOF" >> $GITHUB_OUTPUT
echo "$modified_content" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- id: 'step-4'
name: 'Create Release'
uses: 'softprops/action-gh-release@v1'
with:
body: '${{ steps.step-3.outputs.result }}'
name: '${{ steps.step-2.outputs.substring }}'
tag_name: '${{ steps.step-1.outputs.tag }}'
draft: 'true'
prerelease: '${{ contains(steps.step-1.outputs.tag, ''-'') }}'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
release_github-windows-2019:
name: 'Windows Server 2019 x86_64'
runs-on:
- 'windows-2019'
needs:
- 'create-release'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
with:
submodules: 'recursive'
- id: 'step-1'
name: 'Get Tag'
uses: 'dawidd6/action-get-tag@v1'
- id: 'step-2'
uses: 'bhowell2/github-substring-action@v1.0.0'
with:
value: '${{ steps.step-1.outputs.tag }}'
index_of_str: 'v'
default_return_value: '${{ steps.step-1.outputs.tag }}'
- id: 'step-3'
name: 'Setup JBR 21 for other OS'
uses: 'gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d'
with:
java-version: '21'
distribution: 'jetbrains'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- id: 'step-4'
run: 'echo "jvm.toolchain.version=21" >> local.properties'
- id: 'step-5'
name: 'Setup vcpkg cache'
uses: 'actions/github-script@v7'
with:
script: |-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- id: 'step-6'
name: 'Install Native Dependencies for Windows'
env:
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
run: './ci-helper/install-deps-windows.cmd'
- id: 'step-7'
name: 'Setup Gradle'
uses: 'gradle/actions/setup-gradle@v3'
with:
cache-disabled: 'true'
- id: 'step-8'
name: 'Clean and download dependencies'
uses: 'nick-fields/retry@v2'
with:
timeout_minutes: '60'
max_attempts: '3'
command: './gradlew "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DBoost_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=x86_64"'
- id: 'step-9'
name: 'Update Release Version Name'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_REPOSITORY: '${{ secrets.GITHUB_REPOSITORY }}'
CI_RELEASE_ID: '${{ needs.create-release.outputs.id }}'
CI_TAG: '${{ steps.step-1.outputs.tag }}'
run: './gradlew updateReleaseVersionNameFromGit "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DBoost_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=x86_64"'
- id: 'step-10'
name: 'Check'
uses: 'nick-fields/retry@v2'
with:
timeout_minutes: '60'
max_attempts: '2'
command: './gradlew check "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DBoost_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=x86_64"'
- id: 'step-11'
name: 'Build anitorrent'
run: './gradlew buildAnitorrent copyNativeJarForCurrentPlatform "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DBoost_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=x86_64"'
- id: 'step-12'
name: 'Upload Anitorrent'
uses: 'actions/upload-artifact@v4'
with:
name: 'anitorrent-windows-x64'
path: 'anitorrent-native/build/native-jars/anitorrent-native-*.jar'
if-no-files-found: 'error'
overwrite: 'true'
release_self-hosted-macos-15:
name: 'macOS 15 AArch64 (Self-Hosted)'
runs-on:
- 'self-hosted'
- 'macOS'
- 'ARM64'
needs:
- 'create-release'
if: '${{ github.repository == ''open-ani/anitorrent'' }}'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
with:
submodules: 'recursive'
- id: 'step-1'
name: 'Get Tag'
uses: 'dawidd6/action-get-tag@v1'
- id: 'step-2'
uses: 'bhowell2/github-substring-action@v1.0.0'
with:
value: '${{ steps.step-1.outputs.tag }}'
index_of_str: 'v'
default_return_value: '${{ steps.step-1.outputs.tag }}'
- id: 'step-3'
name: 'Resolve JBR location'
run: |-
# Expand jbrLocationExpr
jbr_location_expr=$(eval echo ${{ runner.tool_cache }}/jbrsdk_jcef-21.0.5-osx-aarch64-b631.8.tar.gz)
echo "jbrLocation=$jbr_location_expr" >> $GITHUB_OUTPUT
- id: 'step-4'
name: 'Get JBR 21 for macOS AArch64'
env:
jbrLocation: '${{ steps.step-3.outputs.jbrLocation }}'
run: |-
jbr_location="$jbrLocation"
checksum_url="https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk_jcef-21.0.5-osx-aarch64-b631.8.tar.gz.checksum"
checksum_file="checksum.tmp"
wget -q -O $checksum_file $checksum_url
expected_checksum=$(awk '{print $1}' $checksum_file)
file_checksum=""
if [ -f "$jbr_location" ]; then
file_checksum=$(shasum -a 512 "$jbr_location" | awk '{print $1}')
fi
if [ "$file_checksum" != "$expected_checksum" ]; then
wget -q --tries=3 https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk_jcef-21.0.5-osx-aarch64-b631.8.tar.gz -O "$jbr_location"
file_checksum=$(shasum -a 512 "$jbr_location" | awk '{print $1}')
fi
if [ "$file_checksum" != "$expected_checksum" ]; then
echo "Checksum verification failed!" >&2
rm -f $checksum_file
exit 1
fi
rm -f $checksum_file
file "$jbr_location"
- id: 'step-5'
name: 'Setup JBR 21 for macOS AArch64'
uses: 'gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d'
with:
java-version: '21'
distribution: 'jdkfile'
jdkFile: '${{ steps.step-3.outputs.jbrLocation }}'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- id: 'step-6'
run: 'echo "jvm.toolchain.version=21" >> local.properties'
- id: 'step-7'
run: 'chmod -R 777 .'
- id: 'step-8'
name: 'Setup Gradle'
uses: 'gradle/actions/setup-gradle@v3'
with:
cache-disabled: 'true'
- id: 'step-9'
name: 'Clean and download dependencies'
uses: 'nick-fields/retry@v2'
with:
timeout_minutes: '60'
max_attempts: '3'
command: './gradlew "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx6g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=arm64-v8a"'
- id: 'step-10'
name: 'Update Release Version Name'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_REPOSITORY: '${{ secrets.GITHUB_REPOSITORY }}'
CI_RELEASE_ID: '${{ needs.create-release.outputs.id }}'
CI_TAG: '${{ steps.step-1.outputs.tag }}'
run: './gradlew updateReleaseVersionNameFromGit "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx6g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=arm64-v8a"'
- id: 'step-11'
name: 'Check'
uses: 'nick-fields/retry@v2'
with:
timeout_minutes: '60'
max_attempts: '2'
command: './gradlew check "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx6g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=arm64-v8a"'
- id: 'step-12'
name: 'Build anitorrent'
run: './gradlew buildAnitorrent copyNativeJarForCurrentPlatform "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx6g" "-Dkotlin.daemon.jvm.options=-Xmx4g" "--parallel" "-Pani.android.abis=arm64-v8a"'
- id: 'step-13'
name: 'Upload Anitorrent'
uses: 'actions/upload-artifact@v4'
with:
name: 'anitorrent-macos-aarch64'
path: 'anitorrent-native/build/native-jars/anitorrent-native-*.jar'
if-no-files-found: 'error'
overwrite: 'true'
- id: 'step-14'
name: 'Cleanup temp files'
continue-on-error: true
run: 'chmod +x ./ci-helper/cleanup-temp-files-macos.sh && ./ci-helper/cleanup-temp-files-macos.sh'
release_github-macos-13:
name: 'macOS 13 x86_64 (GitHub)'
runs-on:
- 'macos-13'
needs:
- 'create-release'
- 'release_github-windows-2019'
- 'release_self-hosted-macos-15'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
with:
submodules: 'recursive'
- id: 'step-1'
name: 'Get Tag'
uses: 'dawidd6/action-get-tag@v1'
- id: 'step-2'
uses: 'bhowell2/github-substring-action@v1.0.0'
with:
value: '${{ steps.step-1.outputs.tag }}'
index_of_str: 'v'
default_return_value: '${{ steps.step-1.outputs.tag }}'
- id: 'step-3'
name: 'Free space for macOS'
continue-on-error: true
run: 'chmod +x ./ci-helper/free-space-macos.sh && ./ci-helper/free-space-macos.sh'
- id: 'step-4'
name: 'Setup JBR 21 for other OS'
uses: 'gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d'
with:
java-version: '21'
distribution: 'jetbrains'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- id: 'step-5'
run: 'echo "jvm.toolchain.version=21" >> local.properties'
- id: 'step-6'
name: 'Install Native Dependencies for MacOS'
run: 'chmod +x ./ci-helper/install-deps-macos-ci.sh && ./ci-helper/install-deps-macos-ci.sh'
- id: 'step-7'
run: 'chmod -R 777 .'
- id: 'step-8'
name: 'Setup Gradle'
uses: 'gradle/actions/setup-gradle@v3'
with:
cache-disabled: 'true'
- id: 'step-9'
name: 'Clean and download dependencies'
uses: 'nick-fields/retry@v2'
with:
timeout_minutes: '60'
max_attempts: '3'
command: './gradlew "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g"'
- id: 'step-10'
name: 'Update Release Version Name'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_REPOSITORY: '${{ secrets.GITHUB_REPOSITORY }}'
CI_RELEASE_ID: '${{ needs.create-release.outputs.id }}'
CI_TAG: '${{ steps.step-1.outputs.tag }}'
run: './gradlew updateReleaseVersionNameFromGit "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g"'
- id: 'step-11'
name: 'Check'
uses: 'nick-fields/retry@v2'
with:
timeout_minutes: '60'
max_attempts: '2'
command: './gradlew check "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g"'
- id: 'step-12'
name: 'Build anitorrent'
run: './gradlew buildAnitorrent copyNativeJarForCurrentPlatform "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g"'
- id: 'step-13'
name: 'Upload Anitorrent'
uses: 'actions/upload-artifact@v4'
with:
name: 'anitorrent-macos-x64'
path: 'anitorrent-native/build/native-jars/anitorrent-native-*.jar'
if-no-files-found: 'error'
overwrite: 'true'
- id: 'step-14'
uses: 'actions/download-artifact@v4'
with:
name: 'anitorrent-windows-x64'
path: 'anitorrent-native/build/native-jars'
- id: 'step-15'
uses: 'actions/download-artifact@v4'
with:
name: 'anitorrent-macos-aarch64'
path: 'anitorrent-native/build/native-jars'
- id: 'step-16'
run: 'ls -l anitorrent-native/build/native-jars'
- id: 'step-17'
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: '${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}'
ORG_GRADLE_PROJECT_mavenCentralPassword: '${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}'
ORG_GRADLE_PROJECT_signingInMemoryKey: '${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}'
ORG_GRADLE_PROJECT_signingInMemoryKeyId: '${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}'
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: '${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}'
run: './gradlew publish "--scan" "--no-configuration-cache" "-Porg.gradle.daemon.idletimeout=60000" "-Pkotlin.native.ignoreDisabledTargets=true" "-Dfile.encoding=UTF-8" "-Dani.enable.anitorrent=true" "-DCMAKE_BUILD_TYPE=Release" "-Dorg.gradle.jvmargs=-Xmx4g" "-Dkotlin.daemon.jvm.options=-Xmx4g"'