chore: update readme

This commit is contained in:
quorafind 2025-06-16 18:39:27 +08:00
parent afbded6693
commit 35e15dbd70
5 changed files with 9178 additions and 87 deletions

View file

@ -1,92 +1,126 @@
# .github/workflows/beta-release.yml
name: 'Automatic Beta Release on PR Commit'
name: "Automatic Beta Release on PR Commit"
on:
pull_request:
# Trigger on PR creation or when new commits are pushed
types: [opened, synchronize]
# IMPORTANT: Change 'main' to your default branch if it's different (e.g., 'master')
branches:
- master
push:
# Only trigger on push to specific branches (more secure)
branches:
- master
- 'feat/**'
- 'release/**'
pull_request:
# Trigger on PR creation or when new commits are pushed
types: [opened, synchronize]
# IMPORTANT: Change 'main' to your default branch if it's different (e.g., 'master')
branches:
- master
push:
# Only trigger on push to specific branches (more secure)
branches:
- master
- "feat/**"
- "release/**"
env:
PLUGIN_NAME: obsidian-task-genius
PLUGIN_NAME: obsidian-task-genius
# Grant permissions for the action to create a release
permissions:
contents: write
pull-requests: read
contents: write
pull-requests: read
jobs:
build-and-release-beta:
if: |
contains(github.event.head_commit.message, '[release-beta]') && (
github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
(github.event.pull_request.author_association == 'OWNER'))
)
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@v4
build-and-release-beta:
if: |
contains(github.event.head_commit.message, '[release-beta]') && (
github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
(github.event.pull_request.author_association == 'OWNER'))
)
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
# Fetch full history to get all tags and commits
fetch-depth: 0
- name: 'Use Node.js 22'
uses: actions/setup-node@v4
with:
node-version: 22
- name: "Use Node.js 22"
uses: actions/setup-node@v4
with:
node-version: 22
- name: 'Install pnpm'
uses: pnpm/action-setup@v4
with:
version: 9
- name: 'Install dependencies'
run: pnpm install
- name: "Install pnpm"
uses: pnpm/action-setup@v4
with:
version: 9
# --- New Step to read version ---
- name: 'Get version from package.json'
id: get_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: 'Build and package plugin'
id: build
run: |
pnpm run build
# Create a directory and copy files for zipping
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}/
# Create the zip file for the release, using the version from package.json
zip -r ${{ env.PLUGIN_NAME }}-${{ env.VERSION }}.zip ./${{ env.PLUGIN_NAME }}
- name: "Install dependencies"
run: pnpm install
- name: 'Create Beta Pre-Release'
uses: softprops/action-gh-release@v2
with:
# Use the body of the PR for the release notes, or commit info for direct push
body: |
${{ github.event_name == 'pull_request' && format('Automated beta release for PR #{0}.', github.event.pull_request.number) || 'Automated beta release from direct push.' }}
Commit: `${{ github.sha }}`
Branch: `${{ github.ref_name }}`
# --- New Step to read version ---
- name: "Get version from package.json"
id: get_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
${{ github.event_name == 'pull_request' && github.event.pull_request.body || github.event.head_commit.message }}
# Mark this as a pre-release, so it doesn't count as a latest official release
prerelease: true
# Use the version from package.json for the tag and release name
tag_name: "v${{ env.VERSION }}"
name: "Beta Release v${{ env.VERSION }}"
# Upload all required assets in one step, using the versioned zip file name
files: |
${{ env.PLUGIN_NAME }}-${{ env.VERSION }}.zip
main.js
manifest.json
styles.css
# --- Get commit messages since last beta release ---
- name: "Get commit messages since last beta release"
id: get_commits
run: |
# Get the latest beta release tag (tags starting with 'v' and containing beta or pre-release)
LAST_BETA_TAG=$(git tag -l "v*" --sort=-version:refname | head -1)
if [ -z "$LAST_BETA_TAG" ]; then
echo "No previous beta release found, getting all commits from the beginning"
COMMIT_MESSAGES=$(git log --pretty=format:"- %s (%an)" --no-merges)
else
echo "Getting commits since last beta release: $LAST_BETA_TAG"
COMMIT_MESSAGES=$(git log ${LAST_BETA_TAG}..HEAD --pretty=format:"- %s (%an)" --no-merges)
fi
# Handle empty commit messages
if [ -z "$COMMIT_MESSAGES" ]; then
COMMIT_MESSAGES="- No new commits since last release"
fi
# Save commit messages to environment variable (handle multiline)
echo "COMMIT_MESSAGES<<EOF" >> $GITHUB_ENV
echo "$COMMIT_MESSAGES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Also save the last beta tag for reference
echo "LAST_BETA_TAG=$LAST_BETA_TAG" >> $GITHUB_ENV
- name: "Build and package plugin"
id: build
run: |
pnpm run build
# Create a directory and copy files for zipping
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}/
# Create the zip file for the release, using the version from package.json
zip -r ${{ env.PLUGIN_NAME }}-${{ env.VERSION }}.zip ./${{ env.PLUGIN_NAME }}
- name: "Create Beta Pre-Release"
uses: softprops/action-gh-release@v2
with:
# Use commit messages since last beta release for the release notes
body: |
${{ github.event_name == 'pull_request' && format('🚀 Automated beta release for PR #{0}', github.event.pull_request.number) || '🚀 Automated beta release' }}
## 📝 Changes since last beta release${{ env.LAST_BETA_TAG && format(' ({0})', env.LAST_BETA_TAG) || '' }}:
${{ env.COMMIT_MESSAGES }}
---
${{ github.event_name == 'pull_request' && github.event.pull_request.body || '' }}
# Mark this as a pre-release, so it doesn't count as a latest official release
prerelease: true
# Use the version from package.json for the tag and release name
tag_name: "v${{ env.VERSION }}"
name: "Beta Release v${{ env.VERSION }}"
# Upload all required assets in one step, using the versioned zip file name
files: |
${{ env.PLUGIN_NAME }}-${{ env.VERSION }}.zip
main.js
manifest.json
styles.css

View file

@ -1,5 +1,5 @@
<p align="center">
<img src="media/task-genius.svg" alt="Task Genius Logo" width="150">
<img src="media/task-genius.webp" alt="Task Genius Logo" width="300">
</p>
Full documentation is available at [Docs](https://taskgenius.md/docs/getting-started).

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
media/task-genius.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

9044
styles.css

File diff suppressed because one or more lines are too long