Skip to content

Add Windows installer #22

Add Windows installer

Add Windows installer #22

Workflow file for this run

name: Release
permissions:
contents: write
on:
push:
branches:
- main
tags:
- 'v[0-9]*.*.*'
env:
CARGO_TERM_COLOR: always
defaults:
run:
# necessary for Windows
shell: bash
jobs:
build-ubuntu:
# 22.04 is the earliest version with OpenSSL 3
runs-on: ubuntu-22.04
env:
TARGET: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: Install dependencies for Ubuntu
run: sudo apt-get install -y curl build-essential libdbus-1-dev libssl-dev pkg-config
- uses: Swatinem/rust-cache@v2
- name: Install rust target
run: rustup target add $TARGET
- run: cargo build --release --target $TARGET
- name: Compress binary
run: zip "aw-watcher-media-player-linux.zip" aw-watcher-media-player
working-directory: target/${{ env.TARGET }}/release
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ env.TARGET }}/release/aw-watcher-media-player-linux.zip
make_latest: false
- run: cargo install cargo-deb
- run: cargo deb
- name: Upload deb to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
overwrite: true
make_latest: false
file: target/debian/aw-*.deb
build-windows:
runs-on: windows-latest
env:
TARGET: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install rust target
run: rustup target add $TARGET
- run: cargo build --release --target $TARGET
- name: Install NSIS
run: choco install nsis
# https://github.com/GsNSIS/EnVar/releases/download/v0.3.1/EnVar-Plugin.zip seems reported as malware by some antivirus.
- name: Setup EnVar Plugin
shell: powershell
run: |
$url = "https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip"
$output = "${{ runner.temp }}\EnVar_plugin.zip"
$nsisDir = "C:\Program Files (x86)\NSIS"
Invoke-WebRequest -Uri $url -OutFile $output
Expand-Archive -Path $output -DestinationPath $nsisDir
Get-ChildItem "C:\Program Files (x86)\NSIS\Plugins"
- name: Create installer
run: makensis windows.nsi
- name: Upload installer to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
overwrite: true
file: "*.exe"
make_latest: false
- name: Compress binary
shell: powershell
run: Compress-Archive aw-watcher-media-player.exe aw-watcher-media-player-windows.zip
working-directory: target/${{ env.TARGET }}/release
- name: Upload binary to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ env.TARGET }}/release/aw-watcher-media-player-windows.zip
overwrite: true
make_latest: false