Skip to content

Merge pull request #4 from mgmerino/fix/windows-error-lifetime #3

Merge pull request #4 from mgmerino/fix/windows-error-lifetime

Merge pull request #4 from mgmerino/fix/windows-error-lifetime #3

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: write
env:
APP_NAME: dustrown
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
artifact_name: dustrown-linux-x86_64
archive_name: dustrown-linux-x86_64.tar.gz
- os: windows-2022
target: x86_64-pc-windows-msvc
artifact_name: dustrown-windows-x86_64
archive_name: dustrown-windows-x86_64.zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libsoup-3.0-dev
- name: Build release binary
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package Linux artifact
if: runner.os == 'Linux'
run: |
mkdir -p dist
cp "target/${{ matrix.target }}/release/${APP_NAME}" dist/
cp README.md dist/
tar -C dist -czf "${{ matrix.archive_name }}" "${APP_NAME}" README.md
- name: Package Windows artifact
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist | Out-Null
Copy-Item "target/${{ matrix.target }}/release/${env:APP_NAME}.exe" -Destination dist/
Copy-Item "README.md" -Destination dist/
Compress-Archive -Path "dist/${env:APP_NAME}.exe", "dist/README.md" -DestinationPath "${{ matrix.archive_name }}"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.archive_name }}
release:
name: Publish GitHub release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
needs: build
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: dustrown-linux-x86_64
path: release-assets
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: dustrown-windows-x86_64
path: release-assets
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
release-assets/*.tar.gz
release-assets/*.zip