Skip to content

Release Obsidian Theme #72

Release Obsidian Theme

Release Obsidian Theme #72

Workflow file for this run

name: Release Obsidian Theme
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
inputs:
version:
description: 'New version or major, minor, patch'
default: 'patch'
required: true
update-manifest:
description: 'Update manifest.json'
default: "true"
required: true
env:
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GH_BOT_NAME: "GitHub Action"
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.10'
cache: 'npm'
# Create release notes
- name: Build and Tag
id: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${{ github.event.inputs.version }}"
echo "${{ github.event.inputs.update-manifest }}"
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
npm install
npm version ${{ github.event.inputs.version }} --no-git-tag-version
VERSION=$(grep '^ "version"' package.json | cut -d'"' -f4)
echo $VERSION
if [ "${{ github.event.inputs.update-manifest }}" = "true" ]; then
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest.json
fi
git add .
git status
git commit -m "🔖 $VERSION"
git push
git tag $VERSION
git push --tags
npm run release-notes -- ${VERSION}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
# Create the release on github
- name: Create Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.build.outputs.version }}" \
-F ./release-notes.md \
--title "Release ${{ steps.build.outputs.version }}" \
--discussion-category "Announcements" \
--verify-tag
gh release upload "${{ steps.build.outputs.version }}" --clobber \
'./manifest.json' \
'./theme.css' \
'./tasks-snippet.css'