Skip to content

Commit

Permalink
feat: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
karlsbeard committed Mar 19, 2024
1 parent c2a8d24 commit c66d1ed
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://opencollective.com/univer
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Bug Report
description: Report an issue that you are experiencing with the plugin
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to fill out this bug report!
- type: textarea
id: description
attributes:
label: Describe the bug
description: What happened? Give a brief 1-2 sentence description
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: What are the steps to reproduce the behavior?
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: What did you expect to happen?
validations:
required: true
- type: dropdown
id: mobile-app
attributes:
label: Are you using the mobile app?
options:
- "Yes"
- "No"
validations:
required: true
- type: textarea
id: debug-info
attributes:
label: Obsidian debug info
description: Please copy your debug info. In Obsidian press Cmd-P (Mac) or Ctrl-P (Windows) on keyboard. Search "Show debug info". Click "copy to clipboard.
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. In Obsidan press Cmd-Option-I (Mac) or Ctrl-Alt-I (Window) on keyboard. Copy any log messages that contain [DataLoom]
render: shell
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Feature Request
description: Suggest a new feature for the plugin
labels: ["enhancement"]
body:
- type: textarea
id: problem
attributes:
label: Problem
description: A feature resolves a limitation or problem. What is the problem that you are trying to solve?
validations:
required: true
- type: textarea
id: solution
attributes:
label: Solution
description: Describe the solution that you'd like to see.
validations:
required: true
- type: textarea
id: additional-details
attributes:
label: Additional details
description: Any additional details regarding the solution or problem. Screenshots, implementations on other websites/apps, etc.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Release Obsidian plugin

on:
push:
tags:
- "*"

env:
PLUGIN_NAME: obsidian-univer

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Build
id: build
run: |
npm install
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 }}
ls
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Upload zip file
id: upload-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.PLUGIN_NAME }}.zip
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
asset_content_type: application/zip

- name: Upload main.js
id: upload-main
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/main.js
asset_name: main.js
asset_content_type: text/javascript

- name: Upload manifest.json
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/manifest.json
asset_name: manifest.json
asset_content_type: application/json

- name: Upload styles.css
id: upload-css
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/styles.css
asset_name: styles.css
asset_content_type: text/css
9 changes: 6 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import dotenv from 'dotenv'
import Package from './package.json'

dotenv.config()
const buildDir = process.env.DIST_DIR ?? 'dist'
let buildDir = process.env.DIST_DIR ?? 'dist'

function generate(isDev?: boolean) {
if(!isDev) {
buildDir = 'dist'
}
return {
name: 'obsidian',
async writeBundle() {
Expand All @@ -20,8 +23,8 @@ function generate(isDev?: boolean) {
minAppVersion: '0.15.0',
description: Package.description,
author: Package.author,
authorUrl: 'https://obsidian.md',
fundingUrl: 'https://obsidian.md/pricing',
authorUrl: 'https://github.com/karlsbeard/obsidian-univer',
fundingUrl: 'https://opencollective.com/univer',
isDesktopOnly: false,
}))
if (isDev)
Expand Down

0 comments on commit c66d1ed

Please sign in to comment.