feature test
Some checks failed
Build packages / build (push) Failing after 20s

This commit is contained in:
paltovkone
2026-03-07 18:38:36 +04:00
parent 2645df7e60
commit b24df20c78

View File

@ -3,78 +3,31 @@ name: Build packages
on:
push:
branches: [main]
paths:
- '*/VERSION'
- '*/nfpm.yaml'
- '.gitea/workflows/build.yml'
workflow_dispatch:
inputs:
package:
description: 'Package name (leave empty for all)'
required: false
description: 'Package name'
required: true
jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Build matrix
id: set-matrix
run: |
if [ -n "${{ github.event.inputs.package }}" ]; then
MATRIX="[\"${{ github.event.inputs.package }}\"]"
else
if git rev-parse HEAD~1 >/dev/null 2>&1; then
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
else
CHANGED_FILES=$(git diff-tree --no-commit-id -r --name-only HEAD)
fi
CHANGED=$(echo "$CHANGED_FILES" \
| grep -oP '^[^/]+(?=/)' \
| sort -u \
| while read dir; do
[ -f "$dir/nfpm.yaml" ] && echo "$dir"
done)
MATRIX=$(echo "$CHANGED" | grep -v '^$' | jq -R . | jq -sc .)
fi
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Detected packages: $MATRIX"
build:
needs: discover
if: ${{ needs.discover.outputs.matrix != '[]' && needs.discover.outputs.matrix != '' }}
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Read version
run: |
VERSION=$(cat ${{ matrix.package }}/VERSION | tr -d '[:space:]')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Building ${{ matrix.package }} v$VERSION"
echo "VERSION=$(cat ${{ github.event.inputs.package }}/VERSION | tr -d '[:space:]')" >> $GITHUB_ENV
- name: Download upstream
run: |
cd ${{ matrix.package }}
cd ${{ github.event.inputs.package }}
bash scripts/download.sh "$VERSION"
- name: Build deb
run: |
docker run --rm \
-v "$PWD/${{ matrix.package }}:/work" \
-v "$PWD/${{ github.event.inputs.package }}:/work" \
-w /work \
-e VERSION="${{ env.VERSION }}" \
goreleaser/nfpm package \
@ -82,18 +35,12 @@ jobs:
--target /work \
--packager deb
- name: Publish to Gitea
- name: Publish
run: |
DEB=$(ls ${{ matrix.package }}/*.deb | head -1)
echo "Publishing: $DEB"
HTTP_CODE=$(curl -s -o /tmp/upload_response.txt -w "%{http_code}" \
DEB=$(ls ${{ github.event.inputs.package }}/*.deb | head -1)
HTTP_CODE=$(curl -s -o /tmp/resp.txt -w "%{http_code}" \
--user "andrew:${{ secrets.GITEA_TOKEN }}" \
--upload-file "$DEB" \
"https://git.nakolenke.org/api/packages/nakolenke-pub/debian/pool/trixie/main/upload")
cat /tmp/upload_response.txt
echo "HTTP: $HTTP_CODE"
if [ "$HTTP_CODE" != "201" ]; then
echo "Failed to publish"
exit 1
fi
echo "Successfully published $DEB"
cat /tmp/resp.txt
[ "$HTTP_CODE" = "201" ] || exit 1