Files
bhs/.gitea/workflows/build.yaml
Workflow config file is invalid. Please check your config file: yaml: line 2: mapping values are not allowed in this context
2026-01-08 17:48:35 +01:00

66 lines
1.7 KiB
YAML

//
name: Rust CI
on:
push:
branches: [main]
pull_request:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build (release)
run: cargo build --release
- name: Upload artifact (binary)
uses: actions/upload-artifact@v3
with:
name: bhs-linux
path: target/release/black_hole_share
- name: Package for Gitea Packages
if: ${{ gitea.event_name == 'push' && gitea.ref_name == 'main' }}
run: |
set -euo pipefail
mkdir -p dist
cp target/release/black_hole_share dist/
tar -czf dist/black_hole_share-linux.tar.gz -C dist black_hole_share
- name: Publish to Gitea Packages (generic)
if: ${{ gitea.event_name == 'push' && gitea.ref_name == 'main' }}
env:
GITEA_TOKEN: ${{ secrets.GITEA }}
run: |
set -euo pipefail
OWNER="${GITEA_REPOSITORY_OWNER:-icsboyx}"
SHA="${GITEA_SHA:-$(git rev-parse HEAD)}"
PKG_NAME="bhs"
PKG_VERSION="${SHA}"
FILE="dist/black_hole_share-linux.tar.gz"
curl -L --fail \
-H "Authorization: token ${GITEA_TOKEN}" \
--upload-file "${FILE}" \
"https://git.qosnet.it/api/packages/${OWNER}/generic/${PKG_NAME}/${PKG_VERSION}/black_hole_share-linux.tar.gz"