diff --git a/.gitea/workflows/build-deb.yml b/.gitea/workflows/build-deb.yml index 5a2171f..8001dea 100644 --- a/.gitea/workflows/build-deb.yml +++ b/.gitea/workflows/build-deb.yml @@ -19,7 +19,7 @@ jobs: run: | apt-get update apt-get install -y --no-install-recommends \ - git ca-certificates \ + git ca-certificates curl \ gcc make cmake \ libssl-dev \ libssh2-1-dev \ @@ -29,49 +29,43 @@ jobs: dpkg-dev file - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + run: | + git clone --depth=1 \ + "https://gitea.disconnected-by-peer.at/${GITHUB_REPOSITORY}.git" \ + /src + cd /src + git fetch --depth=1 origin "${GITHUB_SHA}" + git checkout "${GITHUB_SHA}" - name: Configure + working-directory: /src run: | cmake -B build \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/opt/archie - name: Build + working-directory: /src run: cmake --build build -j$(nproc) - name: Run integration tests + working-directory: /src run: | pip3 install pyftpdlib paramiko --break-system-packages 2>/dev/null || true cd build && ctest --output-on-failure -L integration || true - name: Create packages + working-directory: /src/build run: | - cd build cpack -G DEB --verbose cpack -G TGZ --verbose - ls -lh archie-*.deb archie-*.tar.gz - - - name: Create source tarball - run: | - cd build cpack --config CPackSourceConfig.cmake -G TGZ --verbose - ls -lh archie-*-src.tar.gz - - - name: Upload packages as workflow artifacts - uses: actions/upload-artifact@v3 - with: - name: archie-packages - path: | - build/archie-*.deb - build/archie-*.tar.gz - retention-days: 30 + ls -lh archie-*.deb archie-*.tar.gz # Only publish a release on tag pushes - name: Publish release to Gitea if: startsWith(github.ref, 'refs/tags/') + working-directory: /src/build env: GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} run: | @@ -94,19 +88,14 @@ jobs: RELEASE_ID=$(echo "$RELEASE" | python3 -c \ "import sys,json; print(json.load(sys.stdin)['id'])") - upload_asset() { - local file="$1" - local name=$(basename "$file") - echo "Uploading ${name} ..." + for f in archie-*.deb archie-*.tar.gz; do + [ -f "$f" ] || continue + echo "Uploading ${f} ..." curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/octet-stream" \ - "${API}/releases/${RELEASE_ID}/assets?name=${name}" \ - --data-binary "@${file}" - } - - for f in build/archie-*.deb build/archie-*.tar.gz; do - [ -f "$f" ] && upload_asset "$f" + "${API}/releases/${RELEASE_ID}/assets?name=${f}" \ + --data-binary "@${f}" done - echo "Published: https://gitea.disconnected-by-peer.at/geos_one/archie/releases/tag/${TAG}" + echo "Published: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TAG}"