ci: Remove all GitHub action dependencies from workflow
Some checks failed
Build .deb Package / build-and-package (push) Failing after 45s
Some checks failed
Build .deb Package / build-and-package (push) Failing after 45s
- Replace actions/checkout with git clone using GITHUB_SERVER_URL - Remove actions/cache (no cross-run caching for now) - Consolidate into single job (no artifact passing needed) - Remove actions/upload-artifact and actions/download-artifact - Pure shell steps only - no cloning from github.com needed
This commit is contained in:
@ -11,39 +11,31 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
# ---------------------------------------------------------------------------
|
||||
# Job 1: Rust Backend - Build + Test
|
||||
# ---------------------------------------------------------------------------
|
||||
build-backend:
|
||||
build-and-package:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl pkg-config libssl-dev ca-certificates
|
||||
# Install Rust toolchain
|
||||
curl pkg-config libssl-dev ca-certificates \
|
||||
git nodejs npm dpkg-dev python3
|
||||
|
||||
- name: Checkout repository
|
||||
run: |
|
||||
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
|
||||
git checkout "$GITHUB_SHA"
|
||||
|
||||
- name: Install Rust toolchain
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
. "$HOME/.cargo/env"
|
||||
rustup default stable
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Cache Cargo registry
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: cargo-
|
||||
|
||||
- name: Build (release)
|
||||
- name: Build Rust backend (release)
|
||||
run: |
|
||||
. "$HOME/.cargo/env"
|
||||
cargo build --release
|
||||
@ -58,26 +50,7 @@ jobs:
|
||||
strip target/release/pm-web
|
||||
strip target/release/pm-worker
|
||||
|
||||
- name: Upload backend artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: backend-binaries
|
||||
path: |
|
||||
target/release/pm-web
|
||||
target/release/pm-worker
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Job 2: Frontend - Build
|
||||
# ---------------------------------------------------------------------------
|
||||
build-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install frontend dependencies
|
||||
working-directory: frontend
|
||||
run: npm ci
|
||||
|
||||
@ -85,44 +58,6 @@ jobs:
|
||||
working-directory: frontend
|
||||
run: npm run build
|
||||
|
||||
- name: Upload frontend artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend/dist/
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Job 3: Package .deb
|
||||
# ---------------------------------------------------------------------------
|
||||
build-deb:
|
||||
needs: [build-backend, build-frontend]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install packaging tools
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends dpkg-dev curl ca-certificates
|
||||
|
||||
- name: Download backend artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: backend-binaries
|
||||
path: target/release/
|
||||
|
||||
- name: Download frontend artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend/dist/
|
||||
|
||||
- name: Make binaries executable
|
||||
run: chmod 755 target/release/pm-web target/release/pm-worker
|
||||
|
||||
- name: Determine version
|
||||
id: version
|
||||
run: |
|
||||
@ -171,7 +106,7 @@ jobs:
|
||||
cp debian/postrm "${BUILD_DIR}/DEBIAN/postrm"
|
||||
chmod 755 "${BUILD_DIR}/DEBIAN/postinst" "${BUILD_DIR}/DEBIAN/prerm" "${BUILD_DIR}/DEBIAN/postrm"
|
||||
|
||||
# Generate control file with computed version and size
|
||||
# Generate control file
|
||||
INSTALLED_SIZE=$(du -sk "${BUILD_DIR}" | cut -f1)
|
||||
cat > "${BUILD_DIR}/DEBIAN/control" <<CTRL
|
||||
Package: linux-patch-manager
|
||||
@ -192,7 +127,8 @@ jobs:
|
||||
# Build .deb
|
||||
DEB_NAME="linux-patch-manager_${VERSION}-1_amd64.deb"
|
||||
dpkg-deb --build "${BUILD_DIR}" "${DEB_NAME}"
|
||||
echo "deb_name=${DEB_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "Built: ${DEB_NAME}"
|
||||
du -h "${DEB_NAME}"
|
||||
|
||||
- name: Verify package
|
||||
run: |
|
||||
@ -202,27 +138,20 @@ jobs:
|
||||
echo "=== Package Size ==="
|
||||
du -h "${DEB_NAME}"
|
||||
|
||||
- name: Upload .deb artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: deb-package
|
||||
path: linux-patch-manager_*.deb
|
||||
|
||||
- name: Create Gitea Release
|
||||
- name: Create Gitea Release (tags only)
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
DEB_NAME=$(ls linux-patch-manager_*.deb)
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
# Use Gitea API to create release and upload asset
|
||||
# Create release via Gitea API
|
||||
curl -s -X POST \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"${GITHUB_REF_NAME}\", \"title\": \"Release ${VERSION}\", \"body\": \"Automated build from tag ${GITHUB_REF_NAME}.\"}" \
|
||||
-o release.json
|
||||
# Extract release ID
|
||||
# Extract release ID and upload .deb
|
||||
RELEASE_ID=$(python3 -c "import json; print(json.load(open('release.json'))['id'])")
|
||||
# Upload .deb as release asset
|
||||
curl -s -X POST \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
|
||||
Reference in New Issue
Block a user