Skip to content

Build and Release

Build and Release #10

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
jobs:
build_windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache
restore-keys: |
${{ runner.os }}-npm-cache
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build for Windows
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run dist -- --win
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-dist
path: dist/
build_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache
restore-keys: |
${{ runner.os }}-npm-cache
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build for Linux
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run dist -- --linux
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-dist
path: dist/
build_mac:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache
restore-keys: |
${{ runner.os }}-npm-cache
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build for Mac
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run dist -- --mac
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mac-dist
path: dist/
create_release:
runs-on: ubuntu-latest
needs: [build_windows, build_linux, build_mac]
if: ${{ success() }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: windows-dist
path: ./dist/
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: linux-dist
path: ./dist/
- name: Download Mac artifact
uses: actions/download-artifact@v4
with:
name: mac-dist
path: ./dist/
- name: Read package.json version
id: get_version
run: echo "::set-output name=version::$(jq -r .version package.json)"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset (Windows Setup)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/windows_dist/ExcalidrawElectron\ Setup\ ${{ steps.get_version.outputs.version }}.exe
asset_name: ExcalidrawElectron_Setup_${{ steps.get_version.outputs.version }}.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (Windows Executable)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/windows_dist/ExcalidrawElectron\ ${{ steps.get_version.outputs.version }}.exe
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/linux_dist/*.AppImage
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.AppImage
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux Deb)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/linux_dist/*.deb
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.deb
asset_content_type: application/vnd.debian.binary-package
- name: Upload Release Asset (Mac App)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/mac_dist/*.dmg
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.dmg
asset_content_type: application/octet-stream
- name: Upload Release Asset (Mac Zip)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/mac/*.zip
asset_name: ExcalidrawElectron_${{ steps.get_version.outputs.version }}.zip
asset_content_type: application/zip