Skip to content

build-windows

build-windows #46

name: Build Windows installer on Release of audiobookshelf
on:
repository_dispatch:
types: [build-windows]
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
required: true
abs_ref:
description: 'Audiobookshelf ref to use'
required: false
jobs:
build-windows:
runs-on: windows-latest
steps:
# 0. Setup steps
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pkg globally (using yao-pkg fork for targetting node20)
run: npm install -g @yao-pkg/pkg
- name: Setup .NET
uses: actions/setup-dotnet@v1
# 1. Build the audiobookshelf executable
- name: Get Latest Audiobookshelf Release Tag
id: get_latest_release
uses: actions/github-script@v7
with:
script: |
const { data } = await github.rest.repos.getLatestRelease({
owner: 'advplyr',
repo: 'audiobookshelf',
})
console.log('Audiobookshelf latest release tag: ' + data.tag_name)
return data.tag_name
result-encoding: string
- uses: actions/checkout@v3
with:
repository: advplyr/audiobookshelf
ref: ${{ github.event_name == 'repository_dispatch' && steps.get_latest_release.outputs.result || inputs.abs_ref }}
path: ./audiobookshelf
- name: Install dependencies
run: npm ci
working-directory: ./audiobookshelf
- name: Build windows executable
run: npm run build-win
working-directory: ./audiobookshelf
# 2. Build the tray app
- uses: actions/checkout@v3
with:
path: ./audiobookshelf-windows
- name: Build solution
run: dotnet build -c Release
working-directory: ./audiobookshelf-windows
# 3. Build the installer
- name: Compile inno setup
run: iscc /DMyAppVersion=${{ github.event_name == 'repository_dispatch' && steps.get_latest_release.outputs.result || inputs.tag }} Setup/installer.iss
working-directory: ./audiobookshelf-windows
# 4. Create a release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event_name == 'repository_dispatch' && steps.get_latest_release.outputs.result || inputs.tag }}
release_name: ${{ github.event_name == 'repository_dispatch' && steps.get_latest_release.outputs.result || inputs.tag }}-auto
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./audiobookshelf-windows/Setup/Output/AudiobookshelfInstaller.exe
asset_name: AudiobookshelfInstaller.${{ github.event_name == 'repository_dispatch' && steps.get_latest_release.outputs.result || inputs.tag }}.exe
asset_content_type: application/x-msdownload