From 98da3e0c05248a00736763b4aafb3cbd20978309 Mon Sep 17 00:00:00 2001 From: Marco De Araujo Date: Wed, 31 Dec 2025 07:28:55 -0400 Subject: [PATCH] Testing workflow --- .forgejo/workflows/release.yaml | 92 +++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml index 9d493de..1f42995 100644 --- a/.forgejo/workflows/release.yaml +++ b/.forgejo/workflows/release.yaml @@ -24,33 +24,48 @@ jobs: - target: x86_64-pc-windows-gnu cross: true linker: x86_64-w64-mingw32-gcc - container: - image: rust:alpine - options: --platform linux/arm64 + steps: - name: Checkout code - uses: docker/checkout@v4 + uses: https://code.forgejo.org/actions/checkout@v4 - - name: Install build dependencies - run: | - apk update - apk add --no-cache \ - build-base \ - gcc-arm-linux-gnueabihf \ - gcc-aarch64-linux-gnu \ - gcc-x86_64-linux-gnu \ - g++-arm-linux-gnueabihf \ - g++-aarch64-linux-gnu \ - mingw-w64 \ - libc6-dev-armhf-cross \ - libc6-dev-arm64-cross \ - musl-dev \ - linux-headers + - name: Setup Rust + uses: https://github.com/dtolnay/rust-toolchain@stable + with: + toolchain: stable - name: Add Rust target if: matrix.target != 'native' run: rustup target add ${{ matrix.target }} + - name: Install cross-compilation tools + if: matrix.cross + run: | + sudo apt-get update + sudo apt-get install -y \ + gcc-arm-linux-gnueabihf \ + gcc-aarch64-linux-gnu \ + gcc-x86-64-linux-gnu \ + g++-arm-linux-gnueabihf \ + g++-aarch64-linux-gnu \ + mingw-w64 \ + libc6-dev-armhf-cross \ + libc6-dev-arm64-cross + + - 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' run: | @@ -63,16 +78,15 @@ jobs: - name: Build release run: | if [ "${{ matrix.target }}" = "native" ]; then - # Build nativo para a arquitetura do runner NATIVE_TARGET=$(rustc -vV | grep 'host:' | cut -d' ' -f2) echo "Building for native target: $NATIVE_TARGET" - cargo build --release --features production + cargo build --release TARGET_BINARY="target/release/uptime-kuma-dashboard" OUTPUT_NAME="uptime-kuma-dashboard-$NATIVE_TARGET" else - # Build com target específico echo "Building for target: ${{ matrix.target }}" - cargo build --release --target ${{ matrix.target }} --features production + 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" @@ -81,29 +95,29 @@ jobs: OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}" fi fi - # Criar diretório de artifacts + mkdir -p release-artifacts - # Verificar se o binário foi criado + if [ ! -f "$TARGET_BINARY" ]; then echo "Error: Binary not found at $TARGET_BINARY" exit 1 fi - # Copiar binário + cp "$TARGET_BINARY" "release-artifacts/$OUTPUT_NAME" - # Strip binário para Linux (reduz tamanho) + if [[ "${{ matrix.target }}" == *"linux"* ]] || [ "${{ matrix.target }}" = "native" ]; then strip "release-artifacts/$OUTPUT_NAME" 2>/dev/null || echo "Strip failed, continuing..." fi - # Tornar executável + if [[ "${{ matrix.target }}" != *"windows"* ]]; then chmod +x "release-artifacts/$OUTPUT_NAME" fi - # Mostrar informações do arquivo + ls -lh "release-artifacts/$OUTPUT_NAME" file "release-artifacts/$OUTPUT_NAME" || true - name: Upload artifacts - uses: docker/upload-artifact@v4 + uses: https://code.forgejo.org/actions/upload-artifact@v4 with: name: binary-${{ matrix.target }} path: release-artifacts/ @@ -116,10 +130,10 @@ jobs: contents: write steps: - name: Checkout code - uses: docker/checkout@v4 + uses: https://code.forgejo.org/actions/checkout@v4 - name: Download all artifacts - uses: docker/download-artifact@v4 + uses: https://code.forgejo.org/actions/download-artifact@v4 with: path: all-artifacts/ @@ -136,13 +150,15 @@ jobs: cat SHA256SUMS.txt - name: Create Release - uses: docker/gitea-release-action@v1 + uses: https://code.forgejo.org/actions/forgejo-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - files: release-artifacts/* - token: ${{ secrets.FORGEGO_TOKEN }} - tag_name: ${{ forgejo.ref_name }} - name: Release ${{ forgejo.ref_name }} - body: | + direction: upload + release-dir: release-artifacts + title: "Release ${{ github.ref_name }}" + tag: ${{ github.ref_name }} + release-notes: | ## 🚀 Multi-Platform Release Compiled on runner **${{ env.RUNNER_ARCH }}** ### 📦 Available Binaries