64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: Release Obsidian plugin
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
env:
|
|
PLUGIN_NAME: obsidian-infio-copilot
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Build
|
|
id: build
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Test
|
|
id: test
|
|
run: |
|
|
npm run test
|
|
|
|
- name: Bundle
|
|
id: bundle
|
|
run: |
|
|
mkdir ${{ env.PLUGIN_NAME }}
|
|
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
|
|
zip -r ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip ${{ env.PLUGIN_NAME }}
|
|
ls
|
|
echo "tag_name=$(git tag --sort version:refname | tail -n 1)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get release notes
|
|
id: release_notes
|
|
run: |
|
|
chmod +x .github/scripts/get-changelog.js
|
|
CHANGELOG=$(node .github/scripts/get-changelog.js ${{ steps.bundle.outputs.tag_name }})
|
|
if [ -z "$CHANGELOG" ]; then
|
|
echo "Error: No release notes found for this version in CHANGELOG.md"
|
|
exit 1
|
|
fi
|
|
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
token: ${{ github.token }}
|
|
files: |
|
|
${{ env.PLUGIN_NAME }}-${{ steps.bundle.outputs.tag_name }}.zip
|
|
main.js
|
|
manifest.json
|
|
styles.css
|
|
body: ${{ steps.release_notes.outputs.changelog }}
|