Skip to content

1.6.0-alpha.2 (#214) #64

1.6.0-alpha.2 (#214)

1.6.0-alpha.2 (#214) #64

Workflow file for this run

name: Build and Publish
on:
push:
branches:
- main
- next
env:
EXECUTABLE_NAME: evidenceangel-ui
CARGO_KEEP_CONSOLE_ON_WINDOWS_FEATURE: windows-keep-console-window
CARGO_EXTRA_BUILD_PARAMS: --features ui --bin evidenceangel-ui
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
permissions: write-all
outputs:
CARGO_PKG_VERSION: ${{ steps.version.outputs.CARGO_PKG_VERSION }}
CARGO_PKG_PRERELEASE: ${{ steps.version.outputs.CARGO_PKG_PRERELEASE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine Cargo version
id: version
run: |
export CARGO_PKG_VERSION=$(awk -F '["=]' '/^\[(workspace.)?package\]/{p=1} p && /^version[[:space:]]*=/ {gsub(/"/, "", $3); print $3; p=0}' Cargo.toml)
export CARGO_PKG_PRERELEASE=$([[ $CARGO_PKG_VERSION =~ -[0-9A-Za-z]+ ]] && echo "true" || echo "false")
echo "CARGO_PKG_VERSION=${CARGO_PKG_VERSION}" >> $GITHUB_OUTPUT
echo "CARGO_PKG_PRERELEASE=${CARGO_PKG_PRERELEASE}" >> $GITHUB_OUTPUT
- name: Create Tag and Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.CARGO_PKG_VERSION }}
release_name: v${{ steps.version.outputs.CARGO_PKG_VERSION }}
prerelease: ${{ steps.version.outputs.CARGO_PKG_PRERELEASE }}
build-cli:
name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }}
runs-on: ${{ matrix.platform.os }}
permissions: write-all
needs:
- create-release
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-aarch64
os: ubuntu-22.04
target: aarch64-unknown-linux-musl
bin: evidenceangel-cli-linux-arm64
- os_name: Linux-x86_64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bin: evidenceangel-cli-linux-amd64
- os_name: Windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: evidenceangel-cli-amd64.exe
- os_name: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: evidenceangel-cli-darwin-amd64
- os_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: evidenceangel-cli-darwin-arm64
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
args: "--features cli --bin evidenceangel-cli --locked --release"
strip: true
- name: Rename binary (linux and macos)
run: mv target/${{ matrix.platform.target }}/release/evidenceangel-cli target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
if: matrix.platform.os_name != 'Windows-x86_64'
- name: Rename binary (windows)
run: mv target/${{ matrix.platform.target }}/release/evidenceangel-cli.exe target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
if: matrix.platform.os_name == 'Windows-x86_64'
- name: Generate SHA-256
run: shasum -a 256 target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} | cut -d ' ' -f 1 > target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.sha256
- name: Release binary and SHA-256 checksum to GitHub
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.create-release.outputs.CARGO_PKG_VERSION }}
prerelease: ${{ needs.create-release.outputs.CARGO_PKG_PRERELEASE }}
files: |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.sha256
build-gtk:
name: Build and Publish (${{ matrix.platform.os_name }})
runs-on: ${{ matrix.platform.os }}
container:
image: ${{ matrix.platform.container }}
permissions: write-all
needs: create-release
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux
os: ubuntu-latest
container: ghcr.io/gtk-rs/gtk4-rs/gtk4:latest
file_suffix: linux-amd64
- os_name: Windows
os: windows-latest
file_suffix: windows-amd64
- os_name: Mac
os: macos-13
file_suffix: mac-amd64
- os_name: Mac
os: macos-latest
file_suffix: mac-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get latest Win-GTK4 build
if: matrix.platform.os_name == 'Windows'
id: wingtk-install
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
REPO_OWNER="wingtk" # Replace with the owner of the repository
REPO_NAME="gvsbuild" # Replace with the name of the repository
ASSET_PREFIX="GTK4" # The prefix of the asset you want to download
mkdir -p "${ASSET_PREFIX}"
cd "${ASSET_PREFIX}" || exit 1
gh release download --repo "$REPO_OWNER/$REPO_NAME" -O "${ASSET_PREFIX}_asset.zip" -p "${ASSET_PREFIX}*" || exit 2
echo "Downloaded asset: ${ASSET_PREFIX}_asset.zip"
unzip "${ASSET_PREFIX}_asset.zip"
mv "${ASSET_PREFIX}_asset.zip" ".."
rm -rf "include/" "python/" "wheels/"
BASE_DIR=$(pwd)
ASSET_PATH=$(realpath "../${ASSET_PREFIX}_asset.zip")
echo "BASE_DIR=$BASE_DIR" >> $GITHUB_OUTPUT
echo "ZIPPED_ASSET=$ASSET_PATH" >> $GITHUB_OUTPUT
- name: Install Mac dependencies
if: matrix.platform.os_name == 'Mac'
run: brew install gtk4 libadwaita
- name: Restore Cargo cache
uses: actions/cache/restore@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
if: matrix.platform.os_name != 'Windows'
run: |
cargo build --release ${{ env.CARGO_EXTRA_BUILD_PARAMS }}
strip target/release/${{ env.EXECUTABLE_NAME }}
mv target/release/${{ env.EXECUTABLE_NAME }} target/release/${{ env.EXECUTABLE_NAME }}-${{ matrix.platform.file_suffix }}
- name: Build
if: matrix.platform.os_name == 'Windows'
shell: bash
run: |
PATH="${{ steps.wingtk-install.outputs.BASE_DIR }}/bin:$PATH"
LIB="${{ steps.wingtk-install.outputs.BASE_DIR }}/lib:$LIB"
INCLUDE="${{ steps.wingtk-install.outputs.BASE_DIR }}/include:${{ steps.wingtk-install.outputs.BASE_DIR }}/include/cairo:${{ steps.wingtk-install.outputs.BASE_DIR }}/include/glib-2.0:${{ steps.wingtk-install.outputs.BASE_DIR }}/include/gobject-introspection-1.0:${{ steps.wingtk-install.outputs.BASE_DIR }}/lib/glib-2.0/include:$INCLUDE"
PKG_CONFIG_PATH="${{ steps.wingtk-install.outputs.BASE_DIR }}/lib/pkgconfig:$PKG_CONFIG_PATH"
mkdir -p bundle/bin
cp -r ${{ steps.wingtk-install.outputs.BASE_DIR }}/* bundle/
rm -rf bundle/include
rm -rf bundle/bin/*.exe
cargo build --release ${{ env.CARGO_EXTRA_BUILD_PARAMS }}
mv target/release/${{ env.EXECUTABLE_NAME }}.exe bundle/bin/${{ env.EXECUTABLE_NAME }}-${{ matrix.platform.file_suffix }}.exe
cargo build --release --features ${{ env.CARGO_KEEP_CONSOLE_ON_WINDOWS_FEATURE }} ${{ env.CARGO_EXTRA_BUILD_PARAMS }}
mv target/release/${{ env.EXECUTABLE_NAME }}.exe bundle/bin/${{ env.EXECUTABLE_NAME }}-console-${{ matrix.platform.file_suffix }}.exe
- name: Build MSI installer
if: matrix.platform.os_name == 'Windows'
shell: bash
run: |
echo Installing cargo-wix...
cargo install cargo-wix
PATH="${{ steps.wingtk-install.outputs.BASE_DIR }}/bin:$PATH"
LIB="${{ steps.wingtk-install.outputs.BASE_DIR }}/lib:$LIB"
INCLUDE="${{ steps.wingtk-install.outputs.BASE_DIR }}/include:${{ steps.wingtk-install.outputs.BASE_DIR }}/include/cairo:${{ steps.wingtk-install.outputs.BASE_DIR }}/include/glib-2.0:${{ steps.wingtk-install.outputs.BASE_DIR }}/include/gobject-introspection-1.0:${{ steps.wingtk-install.outputs.BASE_DIR }}/lib/glib-2.0/include:$INCLUDE"
PKG_CONFIG_PATH="${{ steps.wingtk-install.outputs.BASE_DIR }}/lib/pkgconfig:$PKG_CONFIG_PATH"
echo Rearranging executables...
cp bundle/bin/${{ env.EXECUTABLE_NAME }}-${{ matrix.platform.file_suffix }}.exe target/release/evidenceangel-ui.exe
cp bundle/bin/${{ env.EXECUTABLE_NAME }}-console-${{ matrix.platform.file_suffix }}.exe target/release/evidenceangel-ui-console.exe
echo Building CLI executable...
cargo build --release -F cli --bin evidenceangel-cli
echo Generating Wix script...
rm -rf ${{ steps.wingtk-install.outputs.BASE_DIR }}/include
rm -rf ${{ steps.wingtk-install.outputs.BASE_DIR }}/bin/*.exe
pushd wix || exit
GTK4_PATH="${{ steps.wingtk-install.outputs.BASE_DIR }}" ./generate_wix_script.sh
sed -i 's|/d/|D:/|g' main.wxs
popd || exit
echo Generating installer...
cargo wix --no-build -L -sice:ICE57
- name: Save Cargo cache
uses: actions/cache/save@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Archive release
if: matrix.platform.os_name == 'Windows'
uses: thedoctor0/zip-release@0.7.1
with:
type: zip
path: bundle
filename: ${{ env.EXECUTABLE_NAME }}-${{ matrix.platform.file_suffix }}.zip
- name: Publish release
uses: softprops/action-gh-release@v1
with:
files: |
target/release/${{ env.EXECUTABLE_NAME }}-${{ matrix.platform.file_suffix }}
${{ env.EXECUTABLE_NAME }}-${{ matrix.platform.file_suffix }}.zip
target/wix/*.msi
fail_on_unmatched_files: false
tag_name: ${{ needs.create-release.outputs.CARGO_PKG_VERSION }}
prerelease: ${{ needs.create-release.outputs.CARGO_PKG_PRERELEASE }}