Skip to content

build-icons

build-icons #5

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: ubuntu-latest
steps:
# делаем сheckout в текущем репозитории
- name: Checkout
uses: actions/checkout@v4
with:
ref: dev
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: Generate react-native icons
working-directory: ./plasma
run: |
npx lerna bootstrap --scope="@salutejs/plasma-icons" --ignore-scripts
npm run prebuild --prefix="packages/plasma-icons"
npm run generate:react-native --prefix="packages/plasma-icons"
- name: Verify release branch not exists
working-directory: ./current
shell: bash
run: |
git fetch --all
if git branch -a | grep -q release/plasma-icons-${{ github.event.client_payload.version || github.event.inputs.plasma-version }}; then exit 1; else exit 0; fi
- name: Create release branch
working-directory: ./current
shell: bash
run: |
git fetch --all
git checkout -b release/plasma-icons-${{ github.event.client_payload.version || github.event.inputs.plasma-version }}
- name: Create src folder
working-directory: ./current
continue-on-error: true
run: mkdir -p ./packages/plasma-icons/src
- name: Move generated icons to plasma-icons folder
run: cp -rf plasma/packages/plasma-icons/src-rn-build/. current/packages/plasma-icons/src
- name: Create tag and release pull request
working-directory: ./current
shell: bash
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
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 Android Team"
git add ./packages/plasma-icons/
git commit -m "feat(plasma-icons): New icons were added from plasma v$PLASMA_VER"
git push --set-upstream origin release/plasma-icons-$PLASMA_VER
gh pr create --base dev --head release/plasma-icons-$PLASMA_VER --title "feat(plasma-icons): Update from plasma-web" --body "Icons were updated to v$PLASMA_VER"