Skip to content

feat: new colorscheme Gruvbox Dark #77

feat: new colorscheme Gruvbox Dark

feat: new colorscheme Gruvbox Dark #77

name: Build, minify, lower syntax, bump versions, update download counts & changelog
on:
push:
branches: [main]
paths:
- source/** # only trigger when source files were changed
- .github/workflows/build-and-bump.yml # or on updates to this file itself
workflow_dispatch: # allows manual triggering on GitHub
permissions:
contents: write
#───────────────────────────────────────────────────────────────────────────────
jobs:
bump:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v4
# 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@v4
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 > ./theme.css
# minification & syntax-lowering https://lightningcss.dev/transpilation.html
npm install
export BROWSERSLIST="chrome 108" # lowers syntax to before css-nesting https://caniuse.com/css-nesting
npx lightningcss --minify --browserslist \
--output-file="./theme.css" -- "./theme.css" || exit 1
# check for unsupported features via `doiuse`
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
# append style-settings (last, so not removed by minification)
cat <(echo && echo "/* @settings") ./source/style-settings.yaml <(echo "*/") \
>> ./theme.css
- 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 :/bump.. --format="- %cs %s" | # commits since last `bump` commit
grep -vE "build|ci|refactor|style|bump" | # don't include internal changes
sed -E "s/^(- [0-9-]+) ([^ ]+): /\1 **\2**: /" >> "temp.md" # bold cc keyword
grep -v "^$" "Changelog.md" >> "temp.md"
mv -f "temp.md" "Changelog.md"
- name: commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "bump: version & update changelog"
branch: ${{ github.head_ref }}