refactor: separate media module #14
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, bump version numbers, and update changelog | |
on: | |
push: | |
branches: [main] # not on insider release branch | |
paths: [source/**] # only for build for source files | |
workflow_dispatch: # allows manually 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: Build | |
run: | | |
cat ./source/*.css <(echo "/* @settings") ./source/style-settings.yaml <(echo "*/") \ | |
> ./theme.css | |
- name: Bump version numbers | |
run: | | |
theme_header="./source/00 header.css" | |
versionLine=$(grep --line-number --max-count=1 "^Version" "$theme_header") | |
versionLnum=$(echo "$versionLine" | cut -d: -f1) | |
currentVer=$(echo "$versionLine" | cut -d. -f2) | |
nextVer=$((currentVer + 1)) | |
sed -E -i '' "${versionLnum} s/$currentVer/$nextVer/" "$theme_header" | |
sed -E -i '' "${versionLnum} s/$currentVer/$nextVer/" "./theme.css" | |
sed -E -i '' "/version/ s/$currentVer/$nextVer/" "./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.*-[[:digit:]]+-/badge\/downloads-$dl-/" ./README.md | |
- name: Update Changelog | |
run: | | |
git log :/bump.. --format="- %cs %s" | # commits since last `bump` commit | |
grep -vE "build|ci|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" | |
#───────────────────────────────────────────────────────────────────────── | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "bump: version & update changelog" | |
branch: ${{ github.head_ref }} |