Figma Publish #83
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: Figma Publish | |
on: | |
repository_dispatch: | |
types: [library_publish] | |
workflow_dispatch: | |
inputs: | |
commit_type: | |
description: 'Commit Type' | |
required: true | |
default: 'refactor' | |
type: choice | |
options: | |
- feat | |
- fix | |
- refactor | |
commit_message: | |
description: 'Commit Type' | |
required: true | |
default: 'update icons' | |
type: string | |
concurrency: publish | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
scope: sbb-esta | |
- name: 'Yarn: Install dependencies' | |
run: yarn install --frozen-lockfile --non-interactive | |
- name: 'Release: Set git user' | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
- name: Extract icons | |
run: yarn extract | |
env: | |
FIGMA_FILE_ID: ${{ secrets.FIGMA_FILE_ID }} | |
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit changes | |
run: | | |
if [ -z "${{ inputs.commit_type }}" ] | |
then | |
MESSAGE="${{ github.event.client_payload.description }}" | |
else | |
MESSAGE="${{ inputs.commit_type }}: ${{ inputs.commit_message }}" | |
fi | |
git add --all | |
git commit -m "$MESSAGE" | |
- name: Ensure latest branch state | |
run: git pull --rebase | |
- name: 'Release: Create release with commit-and-tag-version' | |
run: yarn commit-and-tag-version | |
- name: 'Release: Push release to repository' | |
run: git push --follow-tags origin main | |
- name: Publish | |
uses: ./.github/actions/publish | |
with: | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
aws-access-key-id: ${{ secrets.ICON_CDN_AWS_ACCESS_ID }} | |
aws-secret-access-key: ${{ secrets.ICON_CDN_AWS_ACCESS_KEY }} | |
github-token: ${{ secrets.DISPATCH_TOKEN }} |