From b24df20c7816120ff3e326f198e9887139e75eda Mon Sep 17 00:00:00 2001 From: paltovkone Date: Sat, 7 Mar 2026 18:38:36 +0400 Subject: [PATCH] feature test --- .gitea/workflows/build.yml | 73 ++++++-------------------------------- 1 file changed, 10 insertions(+), 63 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index e048eaf..56200ce 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -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