Update TMIcon to v1.40.0: #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: Build TMIcons | ||
on: | ||
push: | ||
branches: | ||
- v4 | ||
paths: | ||
- 'data/**' | ||
jobs: | ||
update-file: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Node.js 20 | ||
uses: actions/setup-node@v3 | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Download font files | ||
run: | | ||
ls | ||
css_url="https://i.icomoon.io/public/a8317e20c1/TMIcons/style.css" | ||
css_file="style.css" | ||
dist_dir="dist/fonts" | ||
curl -o $css_file $css_url | ||
font_urls=$(grep -oP 'url\(\K[^)]+' style.css | sort -u) | ||
for url in $font_urls; do | ||
clean_url=$(echo $url | sed 's/[?#].*//') | ||
filename=$(basename "$clean_url") | ||
full_url=$(echo $url | sed "s/'//g" | sed 's/"//g') | ||
curl -o "$dist_dir/$filename" $full_url | ||
done | ||
rm $css_file | ||
echo "Font files downloaded successfully." | ||
- name: Build SVG files | ||
run: | | ||
node ./script/buildSVGIcons.js | ||
echo "SVG files built successfully." | ||
- name: Build Tonic UI icons data | ||
run: | | ||
npm i | ||
echo "Tonic UI data built successfully." | ||
- name: Commit fonts, svg icons, and Tonic UI data | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: | | ||
majorVersion=$(jq -r '.fontPref.metadata.majorVersion' data/Preferences.json) | ||
minorVersion=$(jq -r '.fontPref.metadata.minorVersion' data/Preferences.json) | ||
version="$majorVersion.$minorVersion.0" | ||
echo "version=$version" >> $GITHUB_ENV | ||
jq --arg new_version "$version" '.version = $new_version' package.json > tmp.json && mv tmp.json package.json | ||
git config --global user.name 'HIE UX Service' | ||
git config --global user.email '[email protected]' | ||
commit_message=$(git log -n 1 --pretty=format:%B) | ||
$commit_message > last_commit.txt | ||
echo "description=$commit_message" >> $GITHUB_ENV | ||
git add --all | ||
git reset last_commit.txt | ||
git commit -F last_commit.txt | ||
git push | ||
git tag "v$version" | ||
git push origin "v$version" | ||
- name: Create GitHub Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
tag_name: v${{ env.version }} | ||
release_name: TMIcon <v${{ env.version }}> | ||
body: ${{ env.description }} | ||
draft: false | ||
prerelease: false |