generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 140
74 lines (64 loc) · 2.48 KB
/
release.yml
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
69
70
71
72
73
74
name: Release Obsidian Plugin
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "*"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- uses: actions/setup-node@v3
with:
node-version: "21.x" # You might need to adjust this value to your own version
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Git Submodule Update
run: |
git submodule update --init
# Build the plugin
- name: Build
run: |
pnpm i
pnpm run build
# Get the version number and put it in a variable
- name: Get version info
id: version
run: |
echo "name=$(git describe --abbrev=0 --tags)" >> $GITHUB_OUTPUT
- name: Prepare manifest file
run: |
if [[ "${{ contains(steps.version.outputs.name, '-beta') }}" == 'true' ]]; then
cp manifest-beta.json manifest.json
else
echo "do nothing"
fi
shell: bash
# Package the required files into a zip
- name: Package plugin archive
run: |
mkdir ${{ github.event.repository.name }}
cp main.js styles.css manifest.json README.md ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}-${{ steps.version.outputs.name }}.zip ${{ github.event.repository.name }}
# Create the release on GitHub
- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
${{ github.event.repository.name }}-${{ steps.version.outputs.name }}.zip
styles.css
main.js
manifest.json
name: ${{ steps.version.outputs.name }}
prerelease: ${{ endsWith(github.ref, '-beta') }}
tag_name: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}