Skip to content

Commit

Permalink
fix: enable docker cache
Browse files Browse the repository at this point in the history
  • Loading branch information
storytellerF committed Dec 11, 2024
1 parent 8f8331b commit 72a6b24
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 32 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/alpha-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [ "alpha" ]
paths:
- '.github/workflows/alpha-server.yml'
- 'backend/**'
- 'cli/**'
- 'crypto-jvm/**'
Expand Down Expand Up @@ -33,6 +34,11 @@ jobs:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Cache Docker images.
uses: ScribeMD/docker-cache@0.5.0
with:
key: docker-${{ runner.os }}-${{ hashFiles(paths) }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build mini service
run: ./scripts/build_scripts/build-service-on-ci.sh
7 changes: 7 additions & 0 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [ "alpha" ]
paths:
- '.github/workflows/alpha.yml'
- 'composeApp/**'
- 'shared/**'
- 'scripts/build_scripts/build-app-on-ci.sh'
Expand All @@ -15,6 +16,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
# this will take the entire vars context configured in the repository > environments
# setting and convert it to JSON so we can automatically assign all the values to the
# runner's environment
VARS_CONTEXT: ${{ toJson(vars) }}
SECRETS_CONTEXT: ${{ toJson(secrets) }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,21 @@ fun InputPrivateKeyPage() {
Button({
if (privateKey.isNotBlank()) {
scope.launch {
globalDialogState.use(appNav::gotoHome) {
val data = client.getData()
val f = finalData(data)
val sig = signature(privateKey, f)
val publicKey = getDerPublicKeyFromPrivateKey(privateKey)
val ad = calcAddress(publicKey)
val u = when {
isSignUp -> client.signUp(publicKey, sig)
else -> client.signIn(ad, sig)
}
LoginViewModel.updateState(ClientSession.SignUpSuccess(privateKey, publicKey, ad))
LoginViewModel.updateSession(data, sig)
LoginViewModel.updateUser(u)
storeToStorage()
}
signUpOrSignIn(appNav, privateKey, isSignUp)
}
}
}) {
Text(if (isSignUp) stringResource(Res.string.start_sign_up) else stringResource(Res.string.start_sign_in))
Text(

stringResource(
if (isSignUp) {
Res.string.start_sign_up
} else {
Res.string.start_sign_in
}
)

)
}
if (isSignUp) {
Button({
Expand All @@ -172,6 +168,28 @@ fun InputPrivateKeyPage() {
}
}

private suspend fun signUpOrSignIn(
appNav: AppNav,
privateKey: String,
isSignUp: Boolean
) {
globalDialogState.use(appNav::gotoHome) {
val data = client.getData()
val f = finalData(data)
val sig = signature(privateKey, f)
val publicKey = getDerPublicKeyFromPrivateKey(privateKey)
val ad = calcAddress(publicKey)
val u = when {
isSignUp -> client.signUp(publicKey, sig)
else -> client.signIn(ad, sig)
}
LoginViewModel.updateState(ClientSession.SignUpSuccess(privateKey, publicKey, ad))
LoginViewModel.updateSession(data, sig)
LoginViewModel.updateUser(u)
storeToStorage()
}
}

@OptIn(ExperimentalSerializationApi::class, ExperimentalSettingsApi::class)
fun restoreFromStorage() {
val loginUser = settings.decodeValueOrNull(LoginUser.serializer(), "login_user") ?: return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ private fun CommunityFloatingButton(
if (community?.isJoined == true) {
appNav.gotoTopicCompose(ObjectType.COMMUNITY, communityId)
} else {

alertDialogState.showMessage(title, message)
}
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fun CommunityIcon(
})
} else {
Box(
modifier = Modifier.background(MaterialTheme.colorScheme.secondaryContainer, shape)
modifier = Modifier.background(MaterialTheme.colorScheme.tertiaryContainer, shape)
.clip(shape)
.size(iconSize)
.clickable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,20 @@ fun CustomSearchBar(scope: SearchScope, leadingIcon: @Composable () -> Unit) {
@Composable
private fun SearchPlaceholder(scope: SearchScope) {
Text(
stringResource(when (scope) {
SearchScope.World -> Res.string.input_search_topics_and_users
SearchScope.MyCommunity -> Res.string.input_search_community
SearchScope.MyRoom -> Res.string.input_search_topics
is SearchScope.CommunityTopic -> Res.string.input_search_topics
is SearchScope.CommunityRoom -> Res.string.input_search_room
is SearchScope.RoomTopic -> Res.string.input_search_topics
is SearchScope.TopicTopic -> Res.string.input_search_topics
is SearchScope.CommunityMember -> Res.string.input_search_members
is SearchScope.RoomMember -> Res.string.input_search_members
SearchScope.Member -> Res.string.input_search_members
})
stringResource(
when (scope) {
SearchScope.World -> Res.string.input_search_topics_and_users
SearchScope.MyCommunity -> Res.string.input_search_community
SearchScope.MyRoom -> Res.string.input_search_topics
is SearchScope.CommunityTopic -> Res.string.input_search_topics
is SearchScope.CommunityRoom -> Res.string.input_search_room
is SearchScope.RoomTopic -> Res.string.input_search_topics
is SearchScope.TopicTopic -> Res.string.input_search_topics
is SearchScope.CommunityMember -> Res.string.input_search_members
is SearchScope.RoomMember -> Res.string.input_search_members
SearchScope.Member -> Res.string.input_search_members
}
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ private fun TopicComposeInternal(
3
}
val state = rememberRichTextState()
val tabs = listOf(stringResource(Res.string.edit), stringResource(Res.string.preview), stringResource(Res.string.raw))
val tabs = listOf(
stringResource(Res.string.edit),
stringResource(Res.string.preview),
stringResource(Res.string.raw)
)
val selected = pagerState.currentPage
val coroutineScope = rememberCoroutineScope()

Expand Down
16 changes: 16 additions & 0 deletions scripts/build_scripts/build-app-on-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,23 @@ EOF
./scripts/tool_scripts/modify-flavor.sh "$FLAVOR" "$IS_PROD"

TEMP_FILE=./temp
# 解析SECRETS_CONTEXT 到文件
# Pipe the JSON string into jq
echo "$SECRETS_CONTEXT" |
# Convert JSON object into an array of key-value pairs
jq -r 'to_entries |
# Map over each key-value pair
.[] |
# Format each pair as "KEY=VALUE" and append it all to the environment file
"\(.key)=\(.value)"' >> $TEMP_FILE

while IFS= read -r line; do
# Ignore empty lines and comments
[[ -z "$line" || "$line" =~ ^# ]] && continue
IFS='=' read -r key value <<< "$line"
export "$key"="$value"
done < $TEMP_FILE
#从文件写入环境变量
while IFS= read -r line; do
# Ignore empty lines and comments
[[ -z "$line" || "$line" =~ ^# ]] && continue
Expand Down

0 comments on commit 72a6b24

Please sign in to comment.