143 lines
4.2 KiB
YAML
143 lines
4.2 KiB
YAML
on:
|
|
push:
|
|
tags: v[0-9].[0-9]+.[0-9]+
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CARGO_TERM_COLOR: always
|
|
|
|
name: Create release
|
|
|
|
jobs:
|
|
get_version:
|
|
name: Get version from Git tag
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
project_version: ${{ env.VERSION }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Getting version
|
|
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
create_release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
needs: get_version
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Create Release
|
|
env:
|
|
VERSION: ${{ needs.get_version.outputs.project_version }}
|
|
run: |
|
|
gh release create "$VERSION" \
|
|
--title "$VERSION" \
|
|
--draft \
|
|
--notes "## New
|
|
* Added new features.
|
|
## Bug Fixes & Improvements
|
|
* Various fixes and stability improvements.
|
|
## Documentation & others
|
|
* Updated documentation."
|
|
|
|
linux-nogui:
|
|
name: Build Linux nogui (${{ matrix.arch }})
|
|
needs: [create_release, get_version]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, i686, armhf, armel, arm64]
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y upx-ucl
|
|
cargo install cross --git https://github.com/cross-rs/cross
|
|
|
|
- name: Build and package deb packages
|
|
run: PKGARCH=${{ matrix.arch }} contrib/deb/generate.sh
|
|
|
|
- name: Upload bins & debs
|
|
run: |
|
|
tag_name="${{ needs.get_version.outputs.project_version }}"
|
|
ls -lh ./bin/
|
|
gh release upload "$tag_name" ./bin/alfis-* --clobber
|
|
gh release upload "$tag_name" *.deb --clobber
|
|
|
|
build-and-upload-gui-zips:
|
|
name: Build GUI (${{ matrix.name }})
|
|
needs: [create_release, get_version]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
name: linux-amd64
|
|
bin_path: ./target/release/alfis
|
|
archive_cmd: zip
|
|
- os: windows-latest
|
|
name: windows-amd64
|
|
bin_path: target/release/alfis.exe
|
|
archive_cmd: 7z
|
|
- os: macos-latest
|
|
name: darwin-arm64
|
|
bin_path: ./target/release/alfis
|
|
archive_cmd: zip
|
|
- os: macos-latest
|
|
name: darwin-amd64
|
|
target: x86_64-apple-darwin
|
|
bin_path: ./target/x86_64-apple-darwin/release/alfis
|
|
archive_cmd: zip
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target || '' }}
|
|
|
|
- name: Install Linux dependencies
|
|
if: contains(matrix.os, 'ubuntu')
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
libwebkit2gtk-4.1-dev \
|
|
libgtk-3-dev \
|
|
libxdo-dev \
|
|
libsoup-3.0-dev \
|
|
libayatana-appindicator3-dev
|
|
|
|
- name: Build release binaries
|
|
run: cargo build --release ${{ matrix.target && format('--target {0}', matrix.target) || '' }}
|
|
|
|
- name: Package zip
|
|
env:
|
|
ZIP_NAME: alfis-${{ matrix.name }}-${{ needs.get_version.outputs.project_version }}.zip
|
|
run: |
|
|
if [ "${{ matrix.archive_cmd }}" = "7z" ]; then
|
|
7z a "$ZIP_NAME" "${{ matrix.bin_path }}" alfis.toml README.md LICENSE adblock.txt
|
|
else
|
|
zip "$ZIP_NAME" "${{ matrix.bin_path }}" alfis.toml README.md LICENSE adblock.txt
|
|
fi
|
|
|
|
- name: Upload zip
|
|
env:
|
|
TAG: ${{ needs.get_version.outputs.project_version }}
|
|
ZIP_NAME: alfis-${{ matrix.name }}-${{ needs.get_version.outputs.project_version }}.zip
|
|
run: gh release upload "$TAG" "$ZIP_NAME" --clobber |