mirror of
https://github.com/woodchen-ink/obsidian-lskypro-uploader.git
synced 2025-07-19 06:12:07 +08:00
Compare commits
No commits in common. "main" and "1.0.1" have entirely different histories.
79
.github/workflows/release.yml
vendored
79
.github/workflows/release.yml
vendored
@ -8,40 +8,77 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
PLUGIN_NAME: lskypro-upload
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # 获取完整历史记录
|
||||||
|
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "22.x"
|
node-version: '22.x'
|
||||||
|
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT
|
||||||
|
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Check Version Match
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.version.outputs.version }}" != "${{ steps.version.outputs.tag }}" ]; then
|
||||||
|
echo "Version in manifest.json (${{ steps.version.outputs.version }}) does not match tag (${{ steps.version.outputs.tag }})"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
- name: Build plugin
|
- name: Build plugin
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Create release package
|
||||||
run: |
|
run: |
|
||||||
npm install
|
mkdir ${{ env.PLUGIN_NAME }}
|
||||||
npm run build
|
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
|
||||||
|
if [ -f "styles.css" ]; then
|
||||||
|
cp styles.css ${{ env.PLUGIN_NAME }}
|
||||||
|
fi
|
||||||
|
zip -r ${{ env.PLUGIN_NAME }}-${{ steps.version.outputs.version }}.zip ${{ env.PLUGIN_NAME }}
|
||||||
|
|
||||||
|
- name: Create source packages
|
||||||
|
run: |
|
||||||
|
# 创建临时目录
|
||||||
|
mkdir temp_source
|
||||||
|
# 复制所有文件到临时目录,排除不需要的文件
|
||||||
|
rsync -av --exclude='node_modules' --exclude='${{ env.PLUGIN_NAME }}' --exclude='*.zip' . temp_source/
|
||||||
|
|
||||||
|
# 从临时目录创建压缩包
|
||||||
|
cd temp_source
|
||||||
|
zip -r ../source-code.zip .
|
||||||
|
tar czf ../source-code.tar.gz .
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# 清理临时目录
|
||||||
|
rm -rf temp_source
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
tag="${GITHUB_REF#refs/tags/}"
|
gh release create "${{ steps.version.outputs.tag }}" \
|
||||||
|
--title="${{ steps.version.outputs.tag }}" \
|
||||||
files=()
|
--notes "Release ${{ steps.version.outputs.tag }}" \
|
||||||
for file in main.js manifest.json; do
|
${{ env.PLUGIN_NAME }}-${{ steps.version.outputs.version }}.zip \
|
||||||
if [ -f "$file" ]; then
|
main.js \
|
||||||
files+=("$file")
|
manifest.json \
|
||||||
else
|
$([ -f "styles.css" ] && echo "styles.css") \
|
||||||
echo "Warning: $file not found"
|
source-code.zip \
|
||||||
exit 1
|
source-code.tar.gz
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
gh release create "$tag" \
|
|
||||||
--title="$tag" \
|
|
||||||
--draft \
|
|
||||||
"${files[@]}"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user