1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-07 21:37:04 +09:00

GO-2159 Add maven and branch releases

This commit is contained in:
Mikhail Iudin 2023-10-10 14:28:53 +02:00
parent aa4477bc70
commit edfe1fadab
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
2 changed files with 47 additions and 7 deletions

View file

@ -2,10 +2,21 @@ on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
alpha_version:
description: 'Alpha version'
required: true
default: ''
run-on-runner:
description: 'Specify the runner to use'
required: true
default: 'macos-11'
name: Build
jobs:
build:
runs-on: macos-11
runs-on: ${{ github.event.inputs.run-on-runner }}
steps:
- name: fix android ndk bundle
run: |
@ -58,7 +69,11 @@ jobs:
run: |
GIT_SUMMARY=$(git describe --tags --always)
echo "FLAGS=-X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultAmplitudeKey=${AMPLITUDE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV
echo VERSION=${GITHUB_REF##*/} >> $GITHUB_ENV
VERSION=${{ github.event.inputs.alpha_version }}
if [ -z "$VERSION" ]; then
VERSION=${GITHUB_REF##*/}
fi
echo VERSION=${VERSION} >> $GITHUB_ENV
echo SDKROOT=$(xcrun --sdk macosx --show-sdk-path) >> $GITHUB_ENV
echo GOPRIVATE=github.com/anyproto >> $GITHUB_ENV
echo $(pwd)/deps >> $GITHUB_PATH
@ -151,8 +166,15 @@ jobs:
make test-deps
gomobile bind -tags "envproduction nogrpcserver gomobile nowatchdog nosigar nomutexdeadlockdetector" -ldflags "$FLAGS" -v -target=ios -o Lib.xcframework github.com/anyproto/anytype-heart/clientlibrary/service github.com/anyproto/anytype-heart/core || true
sudo /usr/sbin/purge
gtar --exclude ".*" -czvf ios_framework_${VERSION}.tar.gz Lib.xcframework protobuf json
mv ios_framework_${VERSION}.tar.gz .release/
gtar --exclude ".*" -czvf ios_framework.tar.gz Lib.xcframework protobuf json
gradle publish
mv ios_framework.tar.gz .release/ios_framework_${VERSION}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
MAVEN_ARTIFACT_ID: 'anytype-heart-ios'
MAVEN_ARTIFACT_NAME: 'ios_framework.tar.gz'
MAVEN_ARTIFACT_VERSION: ${VERSION}
- name: Make java protos
run: |
make protos-java
@ -181,7 +203,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
MAVEN_ARTIFACT_ID: 'anytype-heart-android'
MAVEN_ARTIFACT_NAME: 'lib.aar'
MAVEN_ARTIFACT_VERSION: ${VERSION}
- name: Release
if: github.event.inputs.alpha_version == ''
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ contains(github.ref, '-rc') }}
@ -254,7 +280,11 @@ jobs:
GIT_SUMMARY=$(git describe --tags --always)
echo GOPRIVATE=github.com/anyproto >> $GITHUB_ENV
echo "FLAGS=-X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultAmplitudeKey=${AMPLITUDE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV
echo VERSION=${GITHUB_REF##*/} >> $GITHUB_ENV
VERSION=${{ github.event.inputs.alpha_version }}
if [ -z "$VERSION" ]; then
VERSION=${GITHUB_REF##*/}
fi
echo VERSION=${VERSION} >> $GITHUB_ENV
git config --global url."https://${{ secrets.ANYTYPE_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Go mod download
run: |
@ -306,6 +336,7 @@ jobs:
mv js_${VERSION}_${OSARCH}.tar.gz .release/
done
- name: Release
if: github.event.inputs.alpha_version == ''
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ contains(github.ref, '-rc') }}

View file

@ -6,7 +6,15 @@ def githubProperties = new Properties()
def getArtificatId = { ->
return "anytype-heart-android"
return System.getenv("MAVEN_ARTIFACT_ID")
}
def getArtifactName = { ->
return System.getenv("MAVEN_ARTIFACT_NAME")
}
def getArtifactVersion = { ->
return System.getenv("MAVEN_ARTIFACT_VERSION")
}
buildscript {
@ -26,7 +34,8 @@ publishing {
bar(MavenPublication) {
groupId 'io.anyproto' // Replace with group ID
artifactId getArtificatId()
artifact("lib.aar")
artifact getArtifactName()
version getArtifactVersion()
}
}