Skip to content

Commit

Permalink
feat(sdds-icore): added workflows to release icons
Browse files Browse the repository at this point in the history
  • Loading branch information
vkaltyrin committed Apr 8, 2024
1 parent f8d6268 commit 086f574
Show file tree
Hide file tree
Showing 63 changed files with 1,427 additions and 38 deletions.
32 changes: 32 additions & 0 deletions .github/actions/install-certficates/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Install iOS Certificates'

description: 'Install the Apple certificate and provisioning profile'

runs:
using: "composite"
steps:
- name: Install certificates
shell: bash
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
71 changes: 71 additions & 0 deletions .github/workflows/release_icons.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 'Publish icons Release'

on:
pull_request:
push:
tags:
- "SDDSIcons-v[0-9]+.[0-9]+.[0-9]+"

concurrency:
# New commit on branch cancels running workflows of the same branch
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
generate-distribution:
name: Generate icons distribution zip
runs-on: macos-latest
environment: sdds
steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'

- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Build SDDSIcons
run: |
xcodebuild -project SDDSIcons/SDDSIcons.xcodeproj -scheme "Build XCFramework" BUILD_DIR=./build
- name: Generate distribution zip
id: zip_artifact
run: |
#TAG_NAME=${GITHUB_REF#refs/tags/}
TAG_NAME="SDDSIcons-v0.0.1"
echo "Tag name: $TAG_NAME"
zip -r "${TAG_NAME}.zip" ./SDDSIcons/build/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: "0.0.1" #github.ref
token: ${{ secrets.GH_TOKEN }}
109 changes: 109 additions & 0 deletions .github/workflows/update_icons.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
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 }}
ref: feat-icons-png-generator
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
working-directory: ./plasma
run: |
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
gh pr create --base main --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.
4 changes: 4 additions & 0 deletions SDDSDemoApp/SDDSDemoApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
242BF2452BBC616400E4D112 /* SDDSCore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDA2BB5CE5100277123 /* SDDSCore.xcframework */; };
242BF2462BBC616400E4D112 /* SDDSCore.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDA2BB5CE5100277123 /* SDDSCore.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2430DEE02BB5CE5100277123 /* SDDSIcons.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDB2BB5CE5100277123 /* SDDSIcons.xcframework */; };
2430DEE12BB5CE5100277123 /* SDDSIcons.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDB2BB5CE5100277123 /* SDDSIcons.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2430DEE22BB5CE5100277123 /* SDDSSwiftUI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDC2BB5CE5100277123 /* SDDSSwiftUI.xcframework */; };
Expand Down Expand Up @@ -48,6 +50,7 @@
files = (
2430DEE52BB5CE5100277123 /* SDDSUIKit.xcframework in Embed Frameworks */,
2430DEE12BB5CE5100277123 /* SDDSIcons.xcframework in Embed Frameworks */,
242BF2462BBC616400E4D112 /* SDDSCore.xcframework in Embed Frameworks */,
2430DEE32BB5CE5100277123 /* SDDSSwiftUI.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
Expand Down Expand Up @@ -79,6 +82,7 @@
files = (
2430DEE42BB5CE5100277123 /* SDDSUIKit.xcframework in Frameworks */,
2430DEE02BB5CE5100277123 /* SDDSIcons.xcframework in Frameworks */,
242BF2452BBC616400E4D112 /* SDDSCore.xcframework in Frameworks */,
2430DEE22BB5CE5100277123 /* SDDSSwiftUI.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down

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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"info": {
"version": 1,
"author": "xcode"
},
"images": [
{
"scale": "1x",
"idiom": "universal",
"filename": "[email protected]"
},
{
"scale": "2x",
"idiom": "universal",
"filename": "[email protected]"
},
{
"scale": "3x",
"idiom": "universal",
"filename": "[email protected]"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 086f574

Please sign in to comment.