mirror of
https://github.com/ebullient/obsidian-deck-notes.git
synced 2026-07-22 16:20:29 +00:00
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.3.0 to 6.4.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](53b83947a5...48b55a011b)
---
updated-dependencies:
- dependency-name: actions/setup-node
dependency-version: 6.4.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
138 lines
4.3 KiB
YAML
138 lines
4.3 KiB
YAML
name: Release Obsidian Plugin
|
|
# 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
|
|
type: boolean
|
|
update_brat:
|
|
description: 'Update brat manifest'
|
|
default: true
|
|
required: true
|
|
type: boolean
|
|
|
|
env:
|
|
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
|
|
GH_BOT_NAME: "GitHub Action"
|
|
|
|
jobs:
|
|
build:
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.build.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
# persist-credentials required: this step pushes commits and tags
|
|
# zizmor: ignore[artipacked]
|
|
with:
|
|
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: '24'
|
|
cache: 'npm'
|
|
|
|
# Build the plugin
|
|
- name: Build and Tag
|
|
id: build
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
INPUT_VERSION: ${{ github.event.inputs.version }}
|
|
INPUT_UPDATE_MANIFEST: ${{ github.event.inputs.update_manifest }}
|
|
INPUT_UPDATE_BRAT: ${{ github.event.inputs.update_brat }}
|
|
run: |
|
|
echo "version: $INPUT_VERSION"
|
|
echo "update_manifest: $INPUT_UPDATE_MANIFEST"
|
|
echo "update_brat: $INPUT_UPDATE_BRAT"
|
|
|
|
git config user.name "$GH_BOT_NAME"
|
|
git config user.email "$GH_BOT_EMAIL"
|
|
|
|
npm ci
|
|
npm version "$INPUT_VERSION" --no-git-tag-version
|
|
VERSION=$(grep '^ "version"' package.json | cut -d'"' -f4)
|
|
echo "$VERSION"
|
|
|
|
if git rev-parse "refs/tags/$VERSION" > /dev/null 2>&1; then
|
|
echo "🛑 Tag $VERSION already exists. Delete the release and tag manually, then re-run."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$INPUT_UPDATE_MANIFEST" = "true" ]; then
|
|
# shellcheck disable=SC2086
|
|
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest.json
|
|
fi
|
|
if [ "$INPUT_UPDATE_BRAT" = "true" ]; then
|
|
# shellcheck disable=SC2086
|
|
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
|
|
fi
|
|
|
|
git add .
|
|
git status
|
|
git commit -m "🔖 $VERSION"
|
|
git push
|
|
|
|
git tag "$VERSION"
|
|
git push --tags
|
|
|
|
npm run brat-notes -- "${VERSION}"
|
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Package the required files into a zip
|
|
- name: Package
|
|
env:
|
|
REPO_NAME: ${{ github.event.repository.name }}
|
|
RELEASE_VERSION: ${{ steps.build.outputs.version }}
|
|
run: |
|
|
mv build "$REPO_NAME"
|
|
zip -r "${REPO_NAME}-${RELEASE_VERSION}.zip" "$REPO_NAME"
|
|
unzip -j "${REPO_NAME}-${RELEASE_VERSION}.zip" \
|
|
"$REPO_NAME/main.js" \
|
|
"$REPO_NAME/styles.css"
|
|
|
|
# Attest build provenance for release artifacts
|
|
- name: Attest build artifacts
|
|
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4
|
|
with:
|
|
subject-path: |
|
|
${{ github.event.repository.name }}-${{ steps.build.outputs.version }}.zip
|
|
./main.js
|
|
./styles.css
|
|
|
|
# Create the release on github
|
|
- name: Create Release
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
INPUT_UPDATE_MANIFEST: ${{ github.event.inputs.update_manifest }}
|
|
REPO_NAME: ${{ github.event.repository.name }}
|
|
RELEASE_VERSION: ${{ steps.build.outputs.version }}
|
|
run: |
|
|
prerelease=true
|
|
if [ "$INPUT_UPDATE_MANIFEST" = "true" ]; then
|
|
prerelease=false
|
|
fi
|
|
|
|
gh release create "$RELEASE_VERSION" \
|
|
-F ./release-notes.md \
|
|
--title "$RELEASE_VERSION" \
|
|
--verify-tag \
|
|
--prerelease=${prerelease} \
|
|
"${REPO_NAME}-${RELEASE_VERSION}.zip" \
|
|
'./main.js' \
|
|
'./styles.css' \
|
|
'./manifest.json' \
|
|
'./manifest-beta.json'
|