build-icons #74
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Icons Pack | |
on: | |
workflow_dispatch: | |
inputs: | |
plasma-ref: | |
required: true | |
default: master | |
plasma-version: | |
required: true | |
checkout-branch: | |
required: false | |
default: main | |
repository_dispatch: | |
types: [ build-icons ] | |
jobs: | |
icons: | |
runs-on: macos-latest | |
environment: sdds | |
env: | |
lerna-scope: '--scope="@salutejs/plasma-icons"' | |
steps: | |
# Checkout в текущем репозитории | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.checkout-branch || 'main' }} | |
show-progress: false | |
fetch-depth: 0 | |
path: current | |
# Checkout репозитория 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 | |
working-directory: ./plasma | |
run: | | |
npx lerna ${{ env.lerna-scope }} run generate:ios | |
- name: Bump version | |
working-directory: ./current | |
run: | | |
ruby ./scripts/bump_version.rb ./SDDSIcons/info.plist | |
- name: Extract new 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 add ./SDDSIcons/info.plist | |
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" |