Skip to content

Commit 6da0e0c

Browse files
committed
release workflow
1 parent 08fc2af commit 6da0e0c

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build obsidian plugin
2+
3+
on:
4+
push:
5+
# Sequence of patterns matched against refs/tags
6+
branches:
7+
- release
8+
tags:
9+
- "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10
10+
11+
env:
12+
PLUGIN_NAME: obsidian-meta-bind-plugin # Change this to the name of your plugin-id folder
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Use Node.js
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: "14.x" # You might need to adjust this value to your own version
24+
- name: Build
25+
id: build
26+
run: |
27+
yarn
28+
yarn run build --if-present
29+
mkdir ${{ env.PLUGIN_NAME }}
30+
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
31+
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
32+
ls
33+
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
34+
- name: Create Release
35+
id: create_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
VERSION: ${{ github.ref }}
40+
with:
41+
tag_name: ${{ github.ref }}
42+
release_name: ${{ github.ref }}
43+
draft: false
44+
prerelease: false
45+
- name: Upload zip file
46+
id: upload-zip
47+
uses: actions/upload-release-asset@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
upload_url: ${{ steps.create_release.outputs.upload_url }}
52+
asset_path: ./${{ env.PLUGIN_NAME }}.zip
53+
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
54+
asset_content_type: application/zip
55+
- name: Upload main.js
56+
id: upload-main
57+
uses: actions/upload-release-asset@v1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
upload_url: ${{ steps.create_release.outputs.upload_url }}
62+
asset_path: ./main.js
63+
asset_name: main.js
64+
asset_content_type: text/javascript
65+
- name: Upload manifest.json
66+
id: upload-manifest
67+
uses: actions/upload-release-asset@v1
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
upload_url: ${{ steps.create_release.outputs.upload_url }}
72+
asset_path: ./manifest.json
73+
asset_name: manifest.json
74+
asset_content_type: application/json
75+
- name: Upload styles.css
76+
id: upload-css
77+
uses: actions/upload-release-asset@v1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
upload_url: ${{ steps.create_release.outputs.upload_url }}
82+
asset_path: ./styles.css
83+
asset_name: styles.css
84+
asset_content_type: text/css

0 commit comments

Comments
 (0)