Skip to content

feat(gh-actions): add build artifacts generation #73

feat(gh-actions): add build artifacts generation

feat(gh-actions): add build artifacts generation #73

Workflow file for this run

name: Release Obsidian Plugin
on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
node-setup:
name: ⚙️ Setup Node.js
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '20'
- run: npm i
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run-lint:
name: ✅ Linter
needs: node-setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '20'
- name: ✅ Run code style linter
id: linter
run: npm run lint
run-tests:
name: 🧪 Tests
needs: node-setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '20'
- name: 🧪 Run tests
id: tests
run: npm run coverage
- name: 📈 Send test coverage to Coveralls
id: coverage
if: steps.tests.outcome == 'success'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-plugin:
name: 📦 Release Obsidian Plugin
needs: [run-lint, run-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '20'
- name: 📗 Build plugin
id: build_plugin
if: steps.cache-node-modules.outcome == 'success'
run: npm run build
- name: Upload build assets
uses: actions/upload-artifact@v4
if: steps.build_plugin.outcome == 'success'
with:
name: build-assets
path: |
main.js
manifest.json
styles.css
retention-days: 3
- name: 📦 Create release
uses: softprops/action-gh-release@v1
if: steps.build_plugin.outcome == 'success' && contains(github.ref, 'refs/tags/')
with:
body: 'This release was generated automatically. Full details will be available soon'
draft: true
files: |
main.js
manifest.json
styles.css