Files
dhl/.gitea/workflows/release.yaml
danielvici123 bf698bdd5a
Some checks failed
Build and Release / Build All Platforms (push) Failing after 1m56s
ci: remove sudo and add checks for tool installation
2026-06-08 21:53:03 +02:00

74 lines
2.4 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build-all:
name: Build All Platforms
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu, x86_64-pc-windows-gnu
- name: Install Cross-Compilation Tools
run: |
if command -v apt-get >/dev/null; then
apt-get update
apt-get install -y mingw-w64 zip
else
echo "apt-get not found, skipping tool installation (assuming tools are pre-installed or not needed for this environment)"
fi
- name: Build Linux
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Build Windows
run: cargo build --release --target x86_64-pc-windows-gnu
env:
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
- name: Package Release Assets
run: |
# Package Linux
mkdir -p dist-linux
cp target/x86_64-unknown-linux-gnu/release/dhl dist-linux/dhl
cp config.json.example dist-linux/config.json
cp response.json.example dist-linux/response.json
tar -czvf dhl-linux.tar.gz -C dist-linux .
# Package Windows
mkdir -p dist-windows
cp target/x86_64-pc-windows-gnu/release/dhl.exe dist-windows/dhl.exe
cp config.json.example dist-windows/config.json
cp response.json.example dist-windows/response.json
# Check if zip is available, otherwise use tar for windows as well
if command -v zip >/dev/null; then
zip -j dhl-windows.zip dist-windows/*
else
tar -czvf dhl-windows.tar.gz -C dist-windows .
mv dhl-windows.tar.gz dhl-windows.zip # Rename for consistency in release step
fi
- name: Create Gitea Release
uses: softprops/action-gh-release@v2
with:
files: |
dhl-linux.tar.gz
dhl-windows.zip
name: Release ${{ github.ref_name }}
tag_name: ${{ github.ref }}
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_API_URL: ${{ github.api_url }}