mirror of
https://github.com/shrekbytes/advanced-pdf-export.git
synced 2026-07-22 07:25:03 +00:00
81 lines
2.3 KiB
YAML
81 lines
2.3 KiB
YAML
name: Release Obsidian Plugin
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- manifest.json
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Check version change
|
|
id: version
|
|
run: |
|
|
OLD_VERSION=$(git show HEAD^:manifest.json | jq -r '.version')
|
|
NEW_VERSION=$(jq -r '.version' manifest.json)
|
|
echo "old=$OLD_VERSION" >> $GITHUB_OUTPUT
|
|
echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
if [ "$OLD_VERSION" = "$NEW_VERSION" ]; then
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
echo "Version unchanged ($NEW_VERSION), skipping release."
|
|
else
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
echo "Version changed: $OLD_VERSION → $NEW_VERSION"
|
|
fi
|
|
|
|
- name: Set up Node.js
|
|
if: steps.version.outputs.changed == 'true'
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "lts/*"
|
|
cache: "npm"
|
|
|
|
- name: Install dependencies
|
|
if: steps.version.outputs.changed == 'true'
|
|
run: npm ci
|
|
|
|
- name: Build plugin
|
|
if: steps.version.outputs.changed == 'true'
|
|
run: npm run build
|
|
|
|
- name: Generate artifact attestations
|
|
if: steps.version.outputs.changed == 'true'
|
|
uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-path: |
|
|
main.js
|
|
styles.css
|
|
|
|
- name: Create and push tag
|
|
if: steps.version.outputs.changed == 'true'
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.new }}"
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git tag "$VERSION"
|
|
git push origin "$VERSION"
|
|
|
|
- name: Create GitHub release
|
|
if: steps.version.outputs.changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.new }}"
|
|
gh release create "$VERSION" \
|
|
--title "$VERSION" \
|
|
--generate-notes \
|
|
main.js \
|
|
manifest.json \
|
|
styles.css
|