node20 #458
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- created | |
env: | |
OBSIDIAN_VERSION: "1.5.11" | |
OBSIDIAN_FLATPAK_COMMIT: 45aca5bfa83d1283e2b75ff7e9c394ea46697eb5eb48703b774f48fca4242c9a | |
NODE_VERSION: 20 | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: $NODE_VERSION | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint | |
run: | | |
npm run lint | |
test-on-linux: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Obsidian | |
run: | | |
sudo apt update | |
sudo apt install flatpak dbus-x11 xvfb | |
flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo | |
flatpak install --user -y flathub md.obsidian.Obsidian | |
#flatpak update --user -y --commit=$OBSIDIAN_FLATPAK_COMMIT md.obsidian.Obsidian | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: $NODE_VERSION | |
- name: Install dependencies | |
run: npm ci | |
- name: Test | |
run: | | |
npm run build-with-tests | |
Xvfb -ac :0 -screen 0 1280x1024x16 & | |
export DISPLAY=:0 | |
export $(dbus-launch) | |
npm test | |
test-on-osx: | |
runs-on: macos-12 | |
steps: | |
- name: Install Obsidian | |
run: | | |
wget -q https://github.com/obsidianmd/obsidian-releases/releases/download/v$OBSIDIAN_VERSION/Obsidian-$OBSIDIAN_VERSION-universal.dmg | |
sudo hdiutil attach Obsidian-$OBSIDIAN_VERSION-universal.dmg | |
sudo cp -rf "/Volumes/Obsidian $OBSIDIAN_VERSION-universal/Obsidian.app" /Applications | |
sudo hdiutil detach "/Volumes/Obsidian $OBSIDIAN_VERSION-universal" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: $NODE_VERSION | |
- name: Install dependencies | |
run: npm ci | |
- name: Test | |
run: | | |
npm run build-with-tests | |
npm test | |
release: | |
if: ${{ github.event_name == 'release' }} | |
runs-on: ubuntu-22.04 | |
needs: [lint, test-on-linux, test-on-osx] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: $NODE_VERSION | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload main.js | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: main.js | |
asset_name: main.js | |
asset_content_type: text/javascript | |
- name: Upload manifest.json | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: manifest.json | |
asset_name: manifest.json | |
asset_content_type: application/json | |
- name: Upload styles.css | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: styles.css | |
asset_name: styles.css | |
asset_content_type: text/css |