Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workflow to update icons #5

Merged
merged 4 commits into from
Apr 9, 2024
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
9 changes: 6 additions & 3 deletions .github/workflows/release_icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,22 @@ jobs:

- name: Build SDDSIcons
run: |
xcodebuild -project SDDSIcons/SDDSIcons.xcodeproj -scheme "Build XCFramework" BUILD_DIR=./build
TAG_NAME=${GITHUB_REF#refs/tags/}
xcodebuild -project SDDSIcons/SDDSIcons.xcodeproj -scheme "Build XCFramework"

- name: Generate distribution zip
id: zip_artifact
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Tag name: $TAG_NAME"
zip -r "${TAG_NAME}.zip" ./SDDSIcons/build/SDDSIcons.xcframework
cd SDDSIcons
mv build $TAG_NAME
zip -r ./../$TAG_NAME.zip $TAG_NAME/SDDSIcons.xcframework
echo "::set-output name=zip_path::${TAG_NAME}.zip"

- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.zip_artifact.outputs.zip_path }}
tag_name: github.ref
tag_name: ${{ github.ref }}
token: ${{ secrets.GH_TOKEN }}
110 changes: 110 additions & 0 deletions .github/workflows/update_icons.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Update Icons Pack

on:
workflow_dispatch:
inputs:
plasma-ref:
required: true
default: master
plasma-version:
required: true
repository_dispatch:
types: [ build-icons ]

jobs:
icons:
runs-on: macos-latest
environment: sdds
env:
lerna-scope: '--scope="@salutejs/plasma-icons"'

steps:
# делаем сheckout в текущем репозитория
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
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 ci

- name: Install plasma-icons
working-directory: ./plasma
run: |
npx lerna bootstrap ${{ env.lerna-scope }}

- name: Generate iOS icons
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkaltyrin

Пакету sharp не понравился флаг --ignore-scripts

Давай немного сделаем иначе и шаг - name: Generate iOS icons разобьем на 2:

- name: Install plasma-icons
        working-directory: ./plasma
        run: |
          npx lerna bootstrap ${{ env.lerna-scope }}

- name: Generate iOS icons
        working-directory: ./plasma
        run: |
          npx lerna ${{ env.lerna-scope }} run generate:ios

env.lerna-scope объявим выше

jobs:
  icons:
    runs-on: macos-latest
    environment: sdds
    env:
      lerna-scope: '--scope="@salutejs/plasma-icons"'

working-directory: ./plasma
run: |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Note]:

проверил в своей песочнице - https://github.com/PoligonSa/plasma-sandbox/actions/runs/8564267911/job/23470540145

работает скрипт

npx lerna ${{ env.lerna-scope }} run generate:ios

- name: Extract current version
id: extract_version
working-directory: ./current
shell: bash
run: |
VER=$(grep -A1 'CFBundleShortVersionString' ./SDDSIcons/info.plist | awk -F'[<>]' '/string/{print $3; exit}')
echo "CFBundleVersion is $VER"
echo "tag=SDDSIcons-v$VER" >> $GITHUB_OUTPUT

- name: Verify release branch not exists
working-directory: ./current
shell: bash
run: |
git fetch --all
if git branch -a | grep -q release/${{ steps.extract_version.outputs.tag }}; then exit 1; else exit 0; fi

- name: Create release branch
working-directory: ./current
shell: bash
run: |
git fetch --all
git checkout -b release/${{steps.extract_version.outputs.tag}}

- name: Move generated icons to XCAssets
run: cp -rf plasma/packages/plasma-icons/icons-ios/. current/SDDSIcons/SDDSIcons/Assets.xcassets

- name: Install SwiftGen
run: |
brew install swiftgen

- name: Run SwiftGen
working-directory: ./current
run: |
cd SDDSIcons
swiftgen

- name: Create tag and release pull request
working-directory: ./current
shell: bash
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
TAG=${{steps.extract_version.outputs.tag}}
PLASMA_VER=${{ github.event.client_payload.version || github.event.inputs.plasma-version }}
git config --local user.email "[email protected]"
git config --local user.name "Salute iOS Team"
git add ./SDDSIcons/SDDSIcons/Assets.xcassets/
git add ./SDDSIcons/Generated/Assets.swift
git commit -m "feat(sdds-acore/icons): New icons were added from plasma v$PLASMA_VER"
git push --set-upstream origin release/$TAG
git tag $TAG
git push origin $TAG
gh pr create --base develop --head release/$TAG --title "Release $TAG" --body "Icons were updated to v$PLASMA_VER"
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Salute Devices

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions SDDSCore/LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Salute Devices

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions SDDSDemoApp/LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Salute Devices

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
17 changes: 12 additions & 5 deletions SDDSDemoApp/SDDSDemoApp/ContentView.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import SwiftUI
import SDDSIcons

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
Text("Hello, world!")
ZStack {
Color.red.opacity(0.3)
.ignoresSafeArea()
VStack {
Text("no bundle")
}
.padding()
}
.padding()
}

Check warning on line 15 in SDDSDemoApp/SDDSDemoApp/ContentView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
private var bundle: Bundle? {
Bundle(for: Icons.self)
}
}

Expand Down
2 changes: 1 addition & 1 deletion SDDSDemoApp/SDDSDemoApp/SDDSDemoApp.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SwiftUI
//import SDDSCore
import SDDSCore
import SDDSUIKit
import SDDSSwiftUI
import SDDSIcons
Expand Down
1 change: 1 addition & 0 deletions SDDSIcons/SDDSIcons.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
242BF2442BBC610200E4D112 /* SDDSIcons.swift in Sources */,
2430DEA02BB5B53B00277123 /* SDDSIcons.docc in Sources */,
242BF24F2BBC687700E4D112 /* Assets.swift in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
5 changes: 5 additions & 0 deletions SDDSIcons/SDDSIcons/SDDSIcons.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public final class Icons {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужен пустой класс?


Check warning on line 4 in SDDSIcons/SDDSIcons/SDDSIcons.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
}
21 changes: 21 additions & 0 deletions SDDSSwiftUI/LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Salute Devices

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions SDDSUIKit/LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Salute Devices

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 0 additions & 23 deletions SddsIcons/Package.swift

This file was deleted.

2 changes: 0 additions & 2 deletions SddsIcons/Sources/SddsIcons/SddsIcons.swift

This file was deleted.

12 changes: 0 additions & 12 deletions SddsIcons/Tests/SddsIconsTests/SddsIconsTests.swift

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ for MODULE in "${!modules[@]}"; do

print_info "Making an archive for iOS device..."
iOS_ARCHIVE_PATH="${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive"
SKIP_LINT=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
SKIP_LINT=YES BUILD_ALL=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

print_info "Making an archive for iOS simulator..."
iOS_SIMULATOR_ARCHIVE_PATH="${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive"
SKIP_LINT=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
SKIP_LINT=YES BUILD_ALL=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

print_info "Making XCFramework..."
SKIP_LINT=YES xcodebuild -create-xcframework -framework "${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -framework "${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -output "${BUILD_PATH}/${SCHEME}.xcframework"
SKIP_LINT=YES BUILD_ALL=YES xcodebuild -create-xcframework -framework "${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -framework "${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -output "${BUILD_PATH}/${SCHEME}.xcframework"

if [ $? -ne 0 ]; then
print_error "Build failed for the scheme $SCHEME."
Expand Down
Loading