63 lines
1.8 KiB
YAML
63 lines
1.8 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: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y mingw-w64
|
|
|
|
- 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
|
|
|
|
- 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
|
|
# Use zip on linux to package windows build
|
|
zip -j dhl-windows.zip dist-windows/*
|
|
|
|
- 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 }}
|