From e9aed1d55c0e99017296d0899e95ecc231d107bf Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Tue, 25 Jul 2023 20:57:33 +0200 Subject: [PATCH] fix: ci workflow (#2) * fix: use ar to extract data from deb file * fix(ci): ignore build version during test --- .github/workflows/test.yaml | 28 ++++++++++++++++++++++++++++ ci/build.sh | 9 ++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..3ba3e79 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,28 @@ +name: test +permissions: + contents: write +on: + pull_request: + workflow_dispatch: +jobs: + release: + name: Package and release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: extractions/setup-just@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-go@v3 + with: + go-version: '>=1.20.0' + - run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest + name: Install dependencies + + - name: Package + run: just build diff --git a/ci/build.sh b/ci/build.sh index cc7b8f2..e643390 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -90,10 +90,13 @@ build() { # create tarball (use deb file as the reference) echo "using tarball packager..." - DEB_FILE=$(ls "$output_dir/${PACKAGE_NAME}"_*.deb) + DEB_FILE=$(find "$output_dir" -name "${PACKAGE_NAME}*.deb" | head -1) + if [ -z "$DEB_FILE" ]; then + echo "WARNING: Could not find the debian file. dir=$output_dir" >&2 + fi - TARBALL="$(echo "${DEB_FILE%.*}.tar.gz" | sed 's/_all//g' )" - tar xvzf "$DEB_FILE" data.tar.gz >/dev/null 2>&1 + TARBALL="$(echo "${DEB_FILE%.*}.tar.gz" | sed 's/_all//g')" + ar x "$DEB_FILE" data.tar.gz mv data.tar.gz "$TARBALL" echo "created tarball: $TARBALL" }