Fix Forgejo workflow: remove GitHub Actions dependency, use native artifact creation

This commit is contained in:
robojerk 2025-07-15 08:47:52 -07:00
parent b067da4d82
commit 000264dbbd

View file

@ -33,17 +33,17 @@ jobs:
if command -v apt-get >/dev/null 2>&1; then
echo "Using apt-get package manager..."
apt-get update
apt-get install -y jq dos2unix bash coreutils
apt-get install -y jq dos2unix bash coreutils zip
elif command -v apk >/dev/null 2>&1; then
echo "Using apk package manager..."
apk update
apk add jq dos2unix bash coreutils
apk add jq dos2unix bash coreutils zip
elif command -v yum >/dev/null 2>&1; then
echo "Using yum package manager..."
yum install -y jq dos2unix bash coreutils
yum install -y jq dos2unix bash coreutils zip
elif command -v dnf >/dev/null 2>&1; then
echo "Using dnf package manager..."
dnf install -y jq dos2unix bash coreutils
dnf install -y jq dos2unix bash coreutils zip
else
echo "No supported package manager found. Checking if tools are already available..."
# Check if tools are already available
@ -246,15 +246,48 @@ jobs:
echo "Files are available in the artifacts/ directory"
echo "=========================================="
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: apt-layer-compiled-scripts
path: |
artifacts/apt-layer.sh
artifacts/install-apt-layer.sh
artifacts/COMPILATION_REPORT.md
retention-days: 30
- name: Create downloadable artifacts
run: |
echo "Creating downloadable artifacts..."
# Create a timestamp for the artifacts
timestamp=$(date +%Y%m%d-%H%M%S)
# Create a zip file with all artifacts
zip -r "apt-layer-compiled-${timestamp}.zip" artifacts/
# Create a simple download script
cat > download-artifacts.sh << 'EOF'
#!/bin/bash
echo "apt-layer Compiled Scripts Downloader"
echo "====================================="
echo ""
echo "This script will download the compiled apt-layer scripts."
echo ""
# Check if we're in a workflow environment
if [[ -n "$GITHUB_WORKSPACE" ]]; then
echo "Running in workflow environment..."
echo "Artifacts are available in the artifacts/ directory"
echo ""
echo "Files:"
ls -la artifacts/
echo ""
echo "To download these files, check the workflow run artifacts section."
else
echo "Not in workflow environment."
echo "Please run this in the context of a workflow run."
fi
EOF
chmod +x download-artifacts.sh
echo "✅ Artifacts prepared for download"
echo "📦 Created: apt-layer-compiled-${timestamp}.zip"
echo "📄 Created: download-artifacts.sh"
echo ""
echo "Files available in artifacts/ directory:"
ls -la artifacts/
- name: Commit compiled scripts (if on main/master)
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
@ -281,8 +314,9 @@ jobs:
echo "✅ Compiled scripts successfully pushed to ${{ github.ref_name }}"
else
echo "⚠️ Failed to push to repository, but compilation was successful"
echo "📦 Compiled scripts are available as workflow artifacts"
echo "📦 Compiled scripts are available in the artifacts/ directory"
echo "📝 You can manually download and commit the compiled scripts"
echo "📄 Check the workflow logs for the compiled files"
exit 0 # Don't fail the workflow, compilation was successful
fi
fi