Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 161 additions & 43 deletions .github/workflows/generate-icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,63 +25,143 @@ jobs:
fetch-depth: 0
path: current

# делаем сheckout репозитория plasma
- name: Checkout to Plasma Web
uses: actions/checkout@v4
with:
repository: salute-developers/plasma
ref: ${{ github.event.client_payload.ref || github.event.inputs.plasma-ref }}
show-progress: false
path: plasma

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: 'plasma/.nvmrc'

- name: Install plasma web project deps
working-directory: ./plasma
run: npm run setup:deps:ci

- name: Generate android icons
working-directory: ./plasma
run: npm run generate:android --workspace="@salutejs/plasma-icons"

- name: Bump version
working-directory: ./current
shell: bash
run: |
./gradlew :sdds-core:icons:bump --info
./gradlew :sdds-core:icons-compose:bump --info

- name: Extract current version
id: extract_version
- name: Extract release metadata
id: release_metadata
working-directory: ./current
shell: bash
run: |
PROPS=./sdds-core/icons/gradle.properties
MAJOR=`cat $PROPS | grep "versionMajor" | cut -d'=' -f2`
MINOR=`cat $PROPS | grep "versionMinor" | cut -d'=' -f2`
PATCH=`cat $PROPS | grep "versionPatch" | cut -d'=' -f2`
VER=$MAJOR.$MINOR.$PATCH
echo $VER
echo "tag=sdds-icons-v$VER" >> $GITHUB_OUTPUT

- name: Verify release branch not exists
set -euo pipefail
read_version() {
local props="$1"
local major minor patch
major="$(sed -n 's/^versionMajor=//p' "$props")"
minor="$(sed -n 's/^versionMinor=//p' "$props")"
patch="$(sed -n 's/^versionPatch=//p' "$props")"
if [[ -z "$major" || -z "$minor" || -z "$patch" ]]; then
echo "error: failed to read version from $props" >&2
exit 1
fi
echo "$major.$minor.$patch"
}
RELEASE_DATE="$(TZ=Europe/Moscow date +'%d-%m-%Y')"
DISPLAY_DATE="${RELEASE_DATE//-/.}"
XML_VERSION="$(read_version ./sdds-core/icons/gradle.properties)"
COMPOSE_VERSION="$(read_version ./sdds-core/icons-compose/gradle.properties)"
echo "Release date: $DISPLAY_DATE"
echo "XML icons version: $XML_VERSION"
echo "Compose icons version: $COMPOSE_VERSION"
echo "display_date=$DISPLAY_DATE" >> "$GITHUB_OUTPUT"
echo "branch=release/icons-$RELEASE_DATE" >> "$GITHUB_OUTPUT"
echo "xml_version=$XML_VERSION" >> "$GITHUB_OUTPUT"
echo "compose_version=$COMPOSE_VERSION" >> "$GITHUB_OUTPUT"

- name: Resolve release branch
id: release_state
working-directory: ./current
shell: bash
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
RELEASE_BRANCH: ${{ steps.release_metadata.outputs.branch }}
DISPLAY_DATE: ${{ steps.release_metadata.outputs.display_date }}
XML_VERSION: ${{ steps.release_metadata.outputs.xml_version }}
COMPOSE_VERSION: ${{ steps.release_metadata.outputs.compose_version }}
PLASMA_VERSION: ${{ github.event.client_payload.version || github.event.inputs.plasma-version }}
run: |
git fetch --all
if git branch -a | grep -q release/${{ steps.extract_version.outputs.tag }}; then exit 1; else exit 0; fi
set -euo pipefail
REMOTE_BRANCH="$(git ls-remote --heads origin "refs/heads/$RELEASE_BRANCH")"
if [[ -z "$REMOTE_BRANCH" ]]; then
echo "recovery=false" >> "$GITHUB_OUTPUT"
exit 0
fi
REMOTE_REF="refs/remotes/origin/$RELEASE_BRANCH"
git fetch origin "refs/heads/$RELEASE_BRANCH:$REMOTE_REF"

read_version_from_ref() {
local ref="$1"
local props="$2"
local content major minor patch
content="$(git show "$ref:$props")"
major="$(sed -n 's/^versionMajor=//p' <<< "$content")"
minor="$(sed -n 's/^versionMinor=//p' <<< "$content")"
patch="$(sed -n 's/^versionPatch=//p' <<< "$content")"
if [[ -z "$major" || -z "$minor" || -z "$patch" ]]; then
echo "error: failed to read version from $ref:$props" >&2
exit 1
fi
echo "$major.$minor.$patch"
}

REMOTE_XML_VERSION="$(read_version_from_ref "$REMOTE_REF" sdds-core/icons/gradle.properties)"
REMOTE_COMPOSE_VERSION="$(read_version_from_ref "$REMOTE_REF" sdds-core/icons-compose/gradle.properties)"
if [[ "$REMOTE_XML_VERSION" != "$XML_VERSION" || "$REMOTE_COMPOSE_VERSION" != "$COMPOSE_VERSION" ]]; then
echo "error: release branch metadata does not match the expected versions" >&2
echo "expected XML=$XML_VERSION Compose=$COMPOSE_VERSION" >&2
echo "actual XML=$REMOTE_XML_VERSION Compose=$REMOTE_COMPOSE_VERSION" >&2
exit 1
fi

XML_CATALOG="$(git show "$REMOTE_REF:gradle/icons.version.toml")"
COMPOSE_CATALOG="$(git show "$REMOTE_REF:gradle/icons-compose.version.toml")"
if ! grep -Fq "sdds-icons = \"$XML_VERSION\"" <<< "$XML_CATALOG"; then
echo "error: XML version catalog does not contain $XML_VERSION" >&2
exit 1
fi
if ! grep -Fq "sdds-icons-compose = \"$COMPOSE_VERSION\"" <<< "$COMPOSE_CATALOG"; then
echo "error: Compose version catalog does not contain $COMPOSE_VERSION" >&2
exit 1
fi

EXPECTED_TITLE="Release icons by $DISPLAY_DATE"
XML_TAG="sdds-icons-v$XML_VERSION"
COMPOSE_TAG="sdds-icons-compose-v$COMPOSE_VERSION"
PR_BODY="$(printf 'Icons were updated from Plasma Web v%s.\n\n- XML tag: `%s`\n- Compose tag: `%s`' "$PLASMA_VERSION" "$XML_TAG" "$COMPOSE_TAG")"
PRS="$(gh pr list --base main --head "$RELEASE_BRANCH" --state all --limit 10 --json number,title,body,state,url)"
PR_COUNT="$(jq 'length' <<< "$PRS")"
if [[ "$PR_COUNT" -eq 0 ]]; then
gh pr create --base main --head "$RELEASE_BRANCH" --title "$EXPECTED_TITLE" --body "$PR_BODY"
elif [[ "$PR_COUNT" -eq 1 ]]; then
PR_STATE="$(jq -r '.[0].state' <<< "$PRS")"
PR_TITLE="$(jq -r '.[0].title' <<< "$PRS")"
PR_BODY_ACTUAL="$(jq -r '.[0].body // ""' <<< "$PRS")"
PR_URL="$(jq -r '.[0].url' <<< "$PRS")"
if [[ "$PR_STATE" != "OPEN" || "$PR_TITLE" != "$EXPECTED_TITLE" ]]; then
echo "error: existing PR has unexpected state or title: $PR_URL" >&2
exit 1
fi
if ! grep -Fq "Plasma Web v$PLASMA_VERSION" <<< "$PR_BODY_ACTUAL" ||
! grep -Fq "$XML_TAG" <<< "$PR_BODY_ACTUAL" ||
! grep -Fq "$COMPOSE_TAG" <<< "$PR_BODY_ACTUAL"; then
echo "error: existing PR does not contain the expected release metadata: $PR_URL" >&2
exit 1
fi
echo "Verified existing release PR: $PR_URL"
else
echo "error: multiple PRs found for $RELEASE_BRANCH" >&2
exit 1
fi

echo "Validated existing release branch: $RELEASE_BRANCH"
echo "recovery=true" >> "$GITHUB_OUTPUT"

- name: Create release branch
if: steps.release_state.outputs.recovery != 'true'
working-directory: ./current
shell: bash
env:
RELEASE_BRANCH: ${{ steps.release_metadata.outputs.branch }}
run: |
git fetch --all
git checkout -b release/${{steps.extract_version.outputs.tag}}
git checkout -b "$RELEASE_BRANCH"

- name: Create version commit
if: steps.release_state.outputs.recovery != 'true'
working-directory: ./current
shell: bash
run: |
Expand All @@ -94,7 +174,34 @@ jobs:
git add ./gradle/icons-compose.version.toml
git commit -m "feat(sdds-acore/icons-compose): Bump icons-compose version"

# делаем сheckout репозитория plasma
- name: Checkout to Plasma Web
if: steps.release_state.outputs.recovery != 'true'
uses: actions/checkout@v4
with:
repository: salute-developers/plasma
ref: ${{ github.event.client_payload.ref || github.event.inputs.plasma-ref }}
show-progress: false
path: plasma

- name: Setup Node.js
if: steps.release_state.outputs.recovery != 'true'
uses: actions/setup-node@v3
with:
node-version-file: 'plasma/.nvmrc'

- name: Install plasma web project deps
if: steps.release_state.outputs.recovery != 'true'
working-directory: ./plasma
run: npm run setup:deps:ci

- name: Generate android icons
if: steps.release_state.outputs.recovery != 'true'
working-directory: ./plasma
run: npm run generate:android --workspace="@salutejs/plasma-icons"

- name: Copy generated icons to drawable folder
if: steps.release_state.outputs.recovery != 'true'
run: |
set -euo pipefail
DRAWABLES=current/sdds-core/icons/src/main/res/drawable
Expand All @@ -106,12 +213,14 @@ jobs:
# sets stay in parity. Valkyrie needs JDK 21 (its jars are compiled to class v65).

- name: Setup Java 21 for Valkyrie
if: steps.release_state.outputs.recovery != 'true'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: Install Valkyrie CLI
if: steps.release_state.outputs.recovery != 'true'
env:
VALKYRIE_VERSION: '1.2.0'
run: |
Expand All @@ -125,6 +234,7 @@ jobs:
echo "VALKYRIE_BIN=$VALKYRIE_BIN" >> "$GITHUB_ENV"

- name: Prepare and filter Compose icons input
if: steps.release_state.outputs.recovery != 'true'
run: |
set -euo pipefail
# Work on a COPY: the XML drawable set must keep both variants of each
Expand All @@ -134,12 +244,14 @@ jobs:
current/.github/scripts/filter-compose-icon-collisions.sh compose-icons-input

- name: Prepare clean Compose icons output
if: steps.release_state.outputs.recovery != 'true'
run: |
set -euo pipefail
rm -rf compose-icons-output
mkdir -p compose-icons-output

- name: Generate Compose icons (Valkyrie)
if: steps.release_state.outputs.recovery != 'true'
# No continue-on-error: Valkyrie exits non-zero on an unhandled
# case-insensitive collision, which MUST fail the run (fail-fast) rather
# than silently skip icons.
Expand All @@ -155,6 +267,7 @@ jobs:
--use-path-data-string true

- name: Merge generated Compose icons
if: steps.release_state.outputs.recovery != 'true'
run: |
set -euo pipefail
GENERATED=compose-icons-output
Expand All @@ -172,25 +285,30 @@ jobs:
done
cp -rf "$GENERATED"/. "$PKG/"

- name: Create tag and release pull request
- name: Create release pull request
if: steps.release_state.outputs.recovery != 'true'
working-directory: ./current
shell: bash
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
RELEASE_BRANCH: ${{ steps.release_metadata.outputs.branch }}
DISPLAY_DATE: ${{ steps.release_metadata.outputs.display_date }}
XML_VERSION: ${{ steps.release_metadata.outputs.xml_version }}
COMPOSE_VERSION: ${{ steps.release_metadata.outputs.compose_version }}
PLASMA_VERSION: ${{ github.event.client_payload.version || github.event.inputs.plasma-version }}
run: |
TAG=${{steps.extract_version.outputs.tag}}
PLASMA_VER=${{ github.event.client_payload.version || github.event.inputs.plasma-version }}
git add -A ./sdds-core/icons/
if git diff --cached --quiet; then
echo "No XML icon changes to commit"
else
git commit -m "feat(sdds-acore/icons): Update xml icons from plasma v$PLASMA_VER"
git commit -m "feat(sdds-acore/icons): Update xml icons from plasma v$PLASMA_VERSION"
fi
git add -A ./sdds-core/icons-compose/
if git diff --cached --quiet; then
echo "No Compose icon changes to commit"
else
git commit -m "feat(sdds-acore/icons-compose): Update compose icons from plasma v$PLASMA_VER"
git commit -m "feat(sdds-acore/icons-compose): Update compose icons from plasma v$PLASMA_VERSION"
fi
git push --set-upstream origin release/$TAG
gh pr create --base main --head release/$TAG --title "Release $TAG" --body "Icons were updated to v$PLASMA_VER"
PR_BODY="$(printf 'Icons were updated from Plasma Web v%s.\n\n- XML tag: `sdds-icons-v%s`\n- Compose tag: `sdds-icons-compose-v%s`' "$PLASMA_VERSION" "$XML_VERSION" "$COMPOSE_VERSION")"
git push --set-upstream origin "$RELEASE_BRANCH"
gh pr create --base main --head "$RELEASE_BRANCH" --title "Release icons by $DISPLAY_DATE" --body "$PR_BODY"
2 changes: 1 addition & 1 deletion gradle/icons-compose.version.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
sdds-icons-compose = "0.1.0"
sdds-icons-compose = "0.2.0"

[libraries]
sdds-icons-compose = { module = "io.github.salute-developers:sdds-icons-compose", version.ref = "sdds-icons-compose" }
2 changes: 1 addition & 1 deletion gradle/icons.version.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
sdds-icons = "0.31.0"
sdds-icons = "0.32.0"

[libraries]
sdds-icons = { module = "io.github.salute-developers:sdds-icons", version.ref = "sdds-icons" }
2 changes: 1 addition & 1 deletion sdds-core/icons-compose/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ nexus.description=SDDS Compose icon pack library (ImageVector, KMP)
tomlPath=../gradle/icons-compose.version.toml
# this version is the latest release version, not the current version
versionMajor=0
versionMinor=1
versionMinor=2
versionPatch=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.sdds.icons.compose

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.addPathNodes
import androidx.compose.ui.unit.dp

public val SddsIcons.ProfilePinFill16: ImageVector by lazy(LazyThreadSafetyMode.NONE) {
ImageVector.Builder(
name = "ProfilePinFill16",
defaultWidth = 16.dp,
defaultHeight = 16.dp,
viewportWidth = 16f,
viewportHeight = 16f
).apply {
addPath(
fill = SolidColor(Color.White),
pathData = addPathNodes("M 13.976 11.004 l -1.096 1.098 l -0.052 0.057 c -0.106 0.142 -0.136 0.323 -0.093 0.486 l 0.04 0.177 c 0.06 0.328 0.02 0.583 -0.121 0.819 c -0.903 -0.909 -1.669 -1.674 -2.42 -2.42 c 0.12 -0.071 0.238 -0.113 0.36 -0.133 c 0.176 -0.028 0.382 -0.014 0.635 0.053 l 0.071 0.013 c 0.17 0.022 0.349 -0.03 0.479 -0.16 l 1.092 -1.095 l 1.105 1.105 Z")
)
addPath(
fill = SolidColor(Color.White),
pathFillType = PathFillType.EvenOdd,
pathData = addPathNodes("M 12.0 8.25 c 2.071 0.0 3.75 1.68 3.75 3.75 c 0.0 2.07 -1.679 3.75 -3.75 3.75 c -2.07 0.0 -3.75 -1.679 -3.75 -3.75 c 0.0 -2.071 1.68 -3.75 3.75 -3.75 Z m 1.366 1.155 c -0.238 -0.237 -0.606 -0.27 -0.877 -0.092 l -0.11 0.09 c -0.272 0.27 -0.714 0.71 -1.046 1.044 c -0.29 -0.07 -0.574 -0.095 -0.851 -0.05 c -0.228 0.036 -0.44 0.118 -0.64 0.244 l -0.195 0.141 c -0.27 0.22 -0.244 0.6 -0.032 0.81 l 1.085 1.085 l -0.99 0.991 c -0.137 0.137 -0.137 0.358 0.0 0.495 c 0.136 0.136 0.357 0.136 0.493 0.0 l 0.99 -0.991 l 1.091 1.09 l 0.086 0.07 c 0.186 0.122 0.444 0.134 0.635 -0.015 l 0.09 -0.088 c 0.416 -0.512 0.481 -1.069 0.334 -1.688 L 14.47 11.5 c 0.274 -0.274 0.273 -0.717 0.0 -0.99 l -1.104 -1.105 Z")
)
addPath(
fill = SolidColor(Color.White),
pathData = addPathNodes("M 8.356 9.36 C 7.817 10.1 7.5 11.012 7.5 12.0 c 0.0 0.82 0.22 1.588 0.604 2.25 h -3.31 c -0.98 0.0 -1.471 0.0 -1.845 -0.191 c -0.33 -0.168 -0.597 -0.436 -0.765 -0.765 C 2.058 13.046 2.015 12.746 2.0 12.286 c -0.012 -0.404 0.165 -0.794 0.486 -1.04 C 4.045 10.05 5.925 9.35 7.95 9.35 c 0.136 0.0 0.271 0.003 0.406 0.01 Z")
)
addPath(
fill = SolidColor(Color.White),
pathData = addPathNodes("M 7.95 2.0 c 1.643 0.0 2.976 1.332 2.976 2.975 S 9.594 7.95 7.951 7.95 S 4.976 6.618 4.976 4.975 S 6.308 2.0 7.95 2.0 Z")
)
}.build()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.sdds.icons.compose

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.addPathNodes
import androidx.compose.ui.unit.dp

public val SddsIcons.ProfilePinFill24: ImageVector by lazy(LazyThreadSafetyMode.NONE) {
ImageVector.Builder(
name = "ProfilePinFill24",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
addPath(
fill = SolidColor(Color.White),
pathData = addPathNodes("M 20.556 15.963 L 18.99 17.53 l -0.072 0.083 c -0.152 0.203 -0.195 0.463 -0.134 0.696 c 0.156 0.593 0.12 1.025 -0.117 1.42 c -1.29 -1.298 -2.382 -2.39 -3.454 -3.455 c 0.17 -0.102 0.338 -0.164 0.512 -0.192 c 0.25 -0.04 0.544 -0.02 0.906 0.076 l 0.104 0.02 c 0.207 0.027 0.423 -0.024 0.598 -0.158 l 0.085 -0.073 l 1.56 -1.561 l 1.578 1.577 Z")
)
addPath(
fill = SolidColor(Color.White),
pathFillType = PathFillType.EvenOdd,
pathData = addPathNodes("M 17.5 12.0 c 3.038 0.0 5.5 2.463 5.5 5.5 c 0.0 3.038 -2.462 5.5 -5.5 5.5 c -3.037 0.0 -5.5 -2.462 -5.5 -5.5 s 2.463 -5.5 5.5 -5.5 Z m 2.186 1.679 c -0.365 -0.364 -0.942 -0.39 -1.335 -0.072 l -0.078 0.069 c -0.387 0.385 -1.017 1.013 -1.49 1.491 c -0.417 -0.1 -0.823 -0.136 -1.218 -0.072 c -0.38 0.061 -0.73 0.21 -1.054 0.445 l -0.139 0.107 c -0.386 0.314 -0.348 0.855 -0.046 1.156 l 1.555 1.549 l -1.418 1.418 c -0.195 0.195 -0.195 0.511 0.0 0.707 c 0.195 0.195 0.512 0.194 0.707 0.0 l 1.418 -1.418 c 0.49 0.49 1.003 1.005 1.553 1.558 c 0.28 0.283 0.774 0.335 1.095 0.02 l 0.062 -0.067 c 0.594 -0.732 0.687 -1.526 0.477 -2.41 c 0.472 -0.475 1.1 -1.103 1.488 -1.49 l 0.068 -0.075 c 0.322 -0.393 0.298 -0.973 -0.068 -1.34 l -1.577 -1.576 Z")
)
addPath(
fill = SolidColor(Color.White),
pathData = addPathNodes("M 12.19 13.754 C 11.44 14.813 11.0 16.104 11.0 17.5 c 0.0 1.184 0.318 2.294 0.871 3.25 h -4.38 c -1.4 0.0 -2.1 0.0 -2.635 -0.273 c -0.47 -0.24 -0.854 -0.622 -1.093 -1.092 c -0.181 -0.356 -0.241 -0.784 -0.26 -1.443 c -0.018 -0.577 0.234 -1.133 0.692 -1.485 c 2.227 -1.708 4.913 -2.707 7.806 -2.707 c 0.063 0.0 0.126 0.003 0.189 0.004 Z")
)
addPath(
fill = SolidColor(Color.White),
pathData = addPathNodes("M 12.0 3.25 c 2.347 0.0 4.25 1.903 4.25 4.25 s -1.903 4.25 -4.25 4.25 S 7.75 9.847 7.75 7.5 S 9.653 3.25 12.0 3.25 Z")
)
}.build()
}
Loading
Loading