Skip to content

Publish Swatches to CDN #65

Publish Swatches to CDN

Publish Swatches to CDN #65

# Publishes pre-built CSS swatches to the Kendo CDN at:
# https://kendo.cdn.telerik.com/themes/<version>/<theme name>/<swatch name>.css
# https://cdn.kendostatic.com/themes/<version>/<theme name>/<swatch name>.css
name: Publish Swatches to CDN
on:
workflow_dispatch:
inputs:
ref:
description: 'Tag or branch to publish'
required: true
default: 'master'
workflow_run:
workflows:
- "Publish to npm"
types:
- completed
jobs:
publish:
runs-on: 'ubuntu-latest'
if: ${{ github.event.inputs.ref || github.event.workflow_run.conclusion == 'success' }}
permissions:
id-token: write # Required by Akeyless
contents: read
packages: read
steps:
- name: Import Secrets
id: import-secrets
uses: LanceMcCarthy/akeyless-action@v3
with:
access-id: ${{ secrets.GH_AKEYLESS_ACCESS_ID }}
static-secrets: '{ "/WebComponents/prod/tokens/GH_TOKEN": "GH_TOKEN" }'
export-secrets-to-environment: false
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup node
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Use cache for root node_modules
id: cache-root-node_modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('package-lock.json') }}
- name: Install
if: steps.cache-root-node_modules.outputs.cache-hit != 'true'
run: npm ci --no-audit --no-fund
- name: Build swatches
run: |
npm run sass
npm run sass:swatches
- name: Checkout artifact repository
uses: actions/checkout@v4
with:
repository: telerik/themes-cdn
token: ${{ steps.import-secrets.outputs.GH_TOKEN }}
path: themes-cdn
lfs: true
- name: Read version
run: |
echo "VERSION=$(jq -r '.version' lerna.json)" >> $GITHUB_ENV
- name: Install rename
run: |
curl https://raw.githubusercontent.com/ap/rename/0da9faa241093c90a40b15a9ff4b36e9858d4516/rename -o ./rename
- name: Package swatches
run: |
perl ./rename -p -e 's/dist\///' -e "s/packages/themes-cdn\/dist\/${{ env.VERSION }}/" packages/*/dist/*.css
- name: Publish swatches
run: |
git config user.name "kendo-bot"
git config user.email "[email protected]"
git add "./dist/${{ env.VERSION }}"
git commit -m "publish ${{ env.VERSION }}"
git push
working-directory: themes-cdn