Testing workflow
This commit is contained in:
parent
8857104e64
commit
390ec63af8
1 changed files with 150 additions and 3 deletions
|
|
@ -155,14 +155,161 @@ jobs:
|
||||||
release-dir: release-artifacts
|
release-dir: release-artifacts
|
||||||
title: "Release ${{ github.ref_name }}"
|
title: "Release ${{ github.ref_name }}"
|
||||||
tag: ${{ github.ref_name }}
|
tag: ${{ github.ref_name }}
|
||||||
release-notes: |
|
release-notesname: Multi-Platform Release Build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: native
|
||||||
|
cross: false
|
||||||
|
container: ""
|
||||||
|
name: "ARM64 NATIVE"
|
||||||
|
|
||||||
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
cross: true
|
||||||
|
container: ghcr.io/forgejo-actions/rust-cross:x86_64-unknown-linux-gnu-2025
|
||||||
|
name: "Linux x86_64"
|
||||||
|
|
||||||
|
- target: x86_64-pc-windows-gnu
|
||||||
|
cross: true
|
||||||
|
container: ghcr.io/forgejo-actions/rust-cross:x86_64-pc-windows-gnu-2025
|
||||||
|
name: "Windows x86_64"
|
||||||
|
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
|
||||||
|
- name: Add Rust target
|
||||||
|
if: matrix.target != 'native' && !matrix.container
|
||||||
|
run: rustup target add ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Cache Rust dependencies
|
||||||
|
uses: https://code.forgejo.org/actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-${{ matrix.target }}-
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
|
- name: Configure cross-compilation
|
||||||
|
if: matrix.cross && matrix.target != 'native' && !matrix.container
|
||||||
|
run: |
|
||||||
|
mkdir -p .cargo
|
||||||
|
cat >> .cargo/config.toml << EOF
|
||||||
|
[target.${{ matrix.target }}]
|
||||||
|
linker = "${{ matrix.linker }}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Build release
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.target }}" = "native" ]; then
|
||||||
|
NATIVE_TARGET=$(rustc -vV | grep 'host:' | cut -d' ' -f2)
|
||||||
|
echo "Building for native target: $NATIVE_TARGET"
|
||||||
|
cargo build --release
|
||||||
|
TARGET_BINARY="target/release/uptime-kuma-dashboard"
|
||||||
|
OUTPUT_NAME="uptime-kuma-dashboard-$NATIVE_TARGET"
|
||||||
|
else
|
||||||
|
echo "Building for target: ${{ matrix.target }}"
|
||||||
|
# Os containers especializados já têm tudo configurado
|
||||||
|
cargo build --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
|
||||||
|
TARGET_BINARY="target/${{ matrix.target }}/release/uptime-kuma-dashboard.exe"
|
||||||
|
OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}.exe"
|
||||||
|
else
|
||||||
|
TARGET_BINARY="target/${{ matrix.target }}/release/uptime-kuma-dashboard"
|
||||||
|
OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p release-artifacts
|
||||||
|
|
||||||
|
if [ ! -f "$TARGET_BINARY" ]; then
|
||||||
|
echo "Error: Binary not found at $TARGET_BINARY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$TARGET_BINARY" "release-artifacts/$OUTPUT_NAME"
|
||||||
|
|
||||||
|
if [[ "${{ matrix.target }}" == *"linux"* ]] || [ "${{ matrix.target }}" = "native" ]; then
|
||||||
|
strip "release-artifacts/$OUTPUT_NAME" 2>/dev/null || echo "Strip failed, continuing..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${{ matrix.target }}" != *"windows"* ]]; then
|
||||||
|
chmod +x "release-artifacts/$OUTPUT_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ls -lh "release-artifacts/$OUTPUT_NAME"
|
||||||
|
file "release-artifacts/$OUTPUT_NAME" || true
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: https://data.forgejo.org/forgejo/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: binary-${{ matrix.target }}
|
||||||
|
path: release-artifacts/
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
create-release:
|
||||||
|
runs-on: docker
|
||||||
|
needs: build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: https://data.forgejo.org/forgejo/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: all-artifacts/
|
||||||
|
|
||||||
|
- name: Prepare release artifacts
|
||||||
|
run: |
|
||||||
|
mkdir -p release-artifacts
|
||||||
|
find all-artifacts -type f -name "uptime-kuma-dashboard-*" -exec cp {} release-artifacts/ \;
|
||||||
|
ls -lh release-artifacts/
|
||||||
|
|
||||||
|
- name: Generate checksums
|
||||||
|
run: |
|
||||||
|
cd release-artifacts
|
||||||
|
sha256sum uptime-kuma-dashboard-* > SHA256SUMS.txt
|
||||||
|
cat SHA256SUMS.txt
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: https://code.forgejo.org/actions/forgejo-release@v2
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
release-dir: release-artifacts
|
||||||
|
title: "Release ${{ github.ref_name }}"
|
||||||
|
tag: ${{ github.ref_name }}
|
||||||
|
release-notes:: |
|
||||||
## 🚀 Multi-Platform Release
|
## 🚀 Multi-Platform Release
|
||||||
Compiled on runner **${{ env.RUNNER_ARCH }}**
|
Compiled on runner **${{ env.RUNNER_ARCH }}**
|
||||||
### 📦 Available Binaries
|
### 📦 Available Binaries
|
||||||
This release includes binaries for the following platforms:
|
This release includes binaries for the following platforms:
|
||||||
- **Linux x86_64** (Intel/AMD 64-bit)
|
- **Linux x86_64** (Intel/AMD 64-bit)
|
||||||
- **Linux ARM64** (aarch64) - Raspberry Pi 4, Apple Silicon Linux, ARM servers
|
- **Linux ARM64** (aarch64) - Raspberry Pi 4, ARM servers
|
||||||
- **Linux ARMv7** (armhf) - Raspberry Pi 3 and earlier
|
|
||||||
- **Windows x86_64** (64-bit)
|
- **Windows x86_64** (64-bit)
|
||||||
### 🚀 How to use
|
### 🚀 How to use
|
||||||
#### Linux/ARM:
|
#### Linux/ARM:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue