Skip to content

fix: further adjustments for Hover Editor plugin #149

fix: further adjustments for Hover Editor plugin

fix: further adjustments for Hover Editor plugin #149

name: Build and bump
on:
push:
branches: [main]
paths:
- source/**
- .github/workflows/build-and-bump.yml # this file itself
workflow_dispatch:
permissions:
contents: write
#───────────────────────────────────────────────────────────────────────────────
# 1. for lightning-css (also lowers syntax to before css-nesting) https://caniuse.com/css-nesting
# 2. for doiuse
env:
BROWSERSLIST: "chrome 108"
#───────────────────────────────────────────────────────────────────────────────
jobs:
bump:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v6
# By default, no tags and only a single commit is fetched. To use git
# history in the changelog step, we need to fetch all history.
with:
fetch-depth: 0 # 0 = all history
fetch-tags: true
- name: setup node
uses: actions/setup-node@v6
with:
node-version: "22.x"
- name: build, lower syntax, and minify
run: |
# Due to globbing, the source files are inserted in alphabetical order.
# To keep things predictable, they are simply number in the order they
# should be included in.
cat ./source/**/*.css > ./temp.css
# minification & syntax-lowering https://lightningcss.dev/transpilation.html
npm install
echo "Syntax lowering for: $BROWSERSLIST"
npx lightningcss --minify --browserslist \
--output-file="./temp.css" -- "./temp.css" || exit 1
# remove old file
rm theme.css
# add header
echo "/*" >> ./theme.css
cat ./source/header.txt >> ./theme.css
echo "*/" >> ./theme.css
# add css
cat ./temp.css >> ./theme.css
rm temp.css
# add style settings
echo "" >> ./theme.css
echo "/* @settings" >> ./theme.css
cat ./source/style-settings.yaml >> theme.css
echo "*/" >> theme.css
- name: check for unsupported features
run: |
echo "doiuse check for: $BROWSERSLIST"
violations=$(npx doiuse --browsers="$BROWSERSLIST" \
--config="./.doiuse-ignore.json" theme.css)
if [[ -n "$violations" ]]; then # `doiuse` does not exit with non-zero code
echo "Doiuse violations:"
echo "$violations"
exit 1
fi
- name: bump version in manifest
run: |
version=$(grep --max-count=1 '"version"' "./manifest.json" | cut -d'"' -f4 | cut -d'.' -f2)
sed -i '' "/version/ s/\.$version/.$((version + 1))/" "./manifest.json"
- name: update download count in readme
run: |
dl=$(curl -s "https://releases.obsidian.md/stats/theme" |
grep -oe '"Shimmering Focus","download":[[:digit:]]*' |
cut -d: -f2)
sed -E -i '' "s/badge.*-[0-9]+-/badge\/downloads-$dl-/" ./README.md
- name: update changelog
run: |
git log --format="- %cs %s" |
grep --extended-regexp "\w+:" | # require cc keyword
grep --extended-regexp --invert-match "(build|ci|style|bump):" | # exclude internal changes
sed -E "s/^(- [0-9-]+) ([^ ]+): /\1 **\2**: /" | # bold cc keyword
grep --invert-match "^$" > "Changelog.md"
- name: commit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "bump: version bump & changelog update"
branch: ${{ github.head_ref }}