-
-
Notifications
You must be signed in to change notification settings - Fork 70
68 lines (59 loc) · 2.14 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (59 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# SOURCE: https://docs.obsidian.md/Plugins/Releasing/Release+your+plugin+with+GitHub+Actions
name: Release Obsidian plugin
on:
push:
tags:
- "[1-9]*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build plugin
run: |
bun install --frozen-lockfile
bun run test || exit 1
bun run build || exit 1
- name: Attest build artifacts
uses: actions/attest-build-provenance@v4
with:
subject-path: |
main.js
styles.css
wasm/pkg/breadcrumbs_graph_wasm_bg.wasm
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}"
prerelease_flag=""
if [[ "$tag" == *beta* ]]; then
prerelease_flag="--prerelease"
else
# Stable releases must originate from main
branch=$(git branch -r --contains "$GITHUB_SHA" | grep -E '^\s*origin/main$' || true)
if [[ -z "$branch" ]]; then
echo "ERROR: Stable tag '$tag' was not pushed from main. Aborting."
exit 1
fi
fi
if [[ -z "$prerelease_flag" ]]; then
cp manifest.json manifest-beta.json
fi
gh release create "$tag" \
--title="$tag" \
$prerelease_flag \
main.js manifest.json manifest-beta.json styles.css