generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 35
63 lines (57 loc) · 1.92 KB
/
publish-beta.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
name: Build plugin
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "*.*.*-beta*"
env:
PLUGIN_NAME: obsidian-reminder
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: Check if the tag commit is equal to the latest commit
run: |
if [ "$(git rev-parse ${{ github.ref }})" != "$(git rev-parse develop)" ]; then
echo "Tag commit is not equal to the latest commit"
exit 1
fi
- name: Update the versions
run: |
version=$(git tag --sort version:refname | tail -n 1)
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
# update manifest version
sed -i "s/\"version\": \".*\"/\"version\": \"$version\"/" manifest-beta.json
# commit and push the changes
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add manifest-beta.json
git commit -m "Update the version to $version"
git push develop
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x" # You might need to adjust this value to your own version
- name: Build
id: build
run: |
npm ci
npm run build
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: ${{ env.RELEASE_VERSION }}
draft: true
prerelease: false
files: |
${{ env.PLUGIN_NAME }}.zip
main.js
manifest.json
styles.css