forked from laofahai/obsidian-tablite
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (58 loc) · 1.85 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (58 loc) · 1.85 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
name: Release Obsidian plugin
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag_name:
description: 'Release Tag (leave empty to use version from manifest.json)'
required: false
default: ''
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Build Plugin
run: npm run build
- name: Generate Build Attestations
uses: actions/attest-build-provenance@v2
with:
subject-path: |
dist/main.js
dist/styles.css
dist/manifest.json
- name: Package and release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "${{ github.event.inputs.tag_name }}" ]; then
tag="${{ github.event.inputs.tag_name }}"
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
tag="${GITHUB_REF#refs/tags/}"
else
tag=$(node -p "require('./manifest.json').version")
fi
echo "Publishing release tag: $tag"
if [ -f dist/styles.css ]; then
gh release create "$tag" \
--title="$tag" \
--generate-notes \
dist/main.js dist/manifest.json dist/styles.css || gh release upload "$tag" dist/main.js dist/manifest.json dist/styles.css --clobber
else
gh release create "$tag" \
--title="$tag" \
--generate-notes \
dist/main.js dist/manifest.json || gh release upload "$tag" dist/main.js dist/manifest.json --clobber
fi