Private
Public Access
1
0

ci: Remove all GitHub action dependencies from workflow
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:
2026-04-24 01:44:21 +00:00
parent a1b2d564e9
commit ffd8c131f6

View File

@ -11,39 +11,31 @@ env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
# --------------------------------------------------------------------------- build-and-package:
# Job 1: Rust Backend - Build + Test
# ---------------------------------------------------------------------------
build-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ubuntu:24.04 image: ubuntu:24.04
steps: steps:
- name: Checkout - name: Install system dependencies
uses: actions/checkout@v4
- name: Install build dependencies
run: | run: |
apt-get update -qq apt-get update -qq
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
curl pkg-config libssl-dev ca-certificates curl pkg-config libssl-dev ca-certificates \
# Install Rust toolchain 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 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
rustup default stable rustup default stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Cache Cargo registry - name: Build Rust backend (release)
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-
- name: Build (release)
run: | run: |
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
cargo build --release cargo build --release
@ -58,26 +50,7 @@ jobs:
strip target/release/pm-web strip target/release/pm-web
strip target/release/pm-worker strip target/release/pm-worker
- name: Upload backend artifacts - name: Install frontend dependencies
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
working-directory: frontend working-directory: frontend
run: npm ci run: npm ci
@ -85,44 +58,6 @@ jobs:
working-directory: frontend working-directory: frontend
run: npm run build 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 - name: Determine version
id: version id: version
run: | run: |
@ -171,7 +106,7 @@ jobs:
cp debian/postrm "${BUILD_DIR}/DEBIAN/postrm" cp debian/postrm "${BUILD_DIR}/DEBIAN/postrm"
chmod 755 "${BUILD_DIR}/DEBIAN/postinst" "${BUILD_DIR}/DEBIAN/prerm" "${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) INSTALLED_SIZE=$(du -sk "${BUILD_DIR}" | cut -f1)
cat > "${BUILD_DIR}/DEBIAN/control" <<CTRL cat > "${BUILD_DIR}/DEBIAN/control" <<CTRL
Package: linux-patch-manager Package: linux-patch-manager
@ -192,7 +127,8 @@ jobs:
# Build .deb # Build .deb
DEB_NAME="linux-patch-manager_${VERSION}-1_amd64.deb" DEB_NAME="linux-patch-manager_${VERSION}-1_amd64.deb"
dpkg-deb --build "${BUILD_DIR}" "${DEB_NAME}" 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 - name: Verify package
run: | run: |
@ -202,27 +138,20 @@ jobs:
echo "=== Package Size ===" echo "=== Package Size ==="
du -h "${DEB_NAME}" du -h "${DEB_NAME}"
- name: Upload .deb artifact - name: Create Gitea Release (tags only)
uses: actions/upload-artifact@v3
with:
name: deb-package
path: linux-patch-manager_*.deb
- name: Create Gitea Release
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
run: | run: |
DEB_NAME=$(ls linux-patch-manager_*.deb) DEB_NAME=$(ls linux-patch-manager_*.deb)
VERSION="${{ steps.version.outputs.version }}" VERSION="${{ steps.version.outputs.version }}"
# Use Gitea API to create release and upload asset # Create release via Gitea API
curl -s -X POST \ curl -s -X POST \
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \ "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
-H "Authorization: token ${GITHUB_TOKEN}" \ -H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"tag_name\": \"${GITHUB_REF_NAME}\", \"title\": \"Release ${VERSION}\", \"body\": \"Automated build from tag ${GITHUB_REF_NAME}.\"}" \ -d "{\"tag_name\": \"${GITHUB_REF_NAME}\", \"title\": \"Release ${VERSION}\", \"body\": \"Automated build from tag ${GITHUB_REF_NAME}.\"}" \
-o release.json -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'])") RELEASE_ID=$(python3 -c "import json; print(json.load(open('release.json'))['id'])")
# Upload .deb as release asset
curl -s -X POST \ curl -s -X POST \
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" \ "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" \
-H "Authorization: token ${GITHUB_TOKEN}" \ -H "Authorization: token ${GITHUB_TOKEN}" \