From a1c07a507e7ebbd3348c74fa021d1561fd7459ac Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Sun, 25 Apr 2021 21:46:21 +0800 Subject: [PATCH] add packaging ci --- .github/workflows/publish.yml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..bf77acc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Publish + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - uses: actions/cache@v2 + with: + path: | + ~/.cabal/packages + ~/.cabal/store + dist-newstyle + key: ${{ runner.os }}-${{ hashFiles('**/*.cabal') }} + restore-keys: | + ${{ runner.os }}- + + - name: Setup Haskell + uses: haskell/actions/setup@v1 + with: + ghc-version: 8.10 + cabal-version: 3.4 + + - name: Install zookeeper-dev on ubuntu + run: sudo apt-get update && sudo apt-get install -y libzookeeper-mt-dev + + - name: Publish package + run: | + cabal sdist && cabal haddock --enable-documentation --haddock-for-hackage + + tar_file=$(cabal sdist | grep zoovisitor) + doc_file=$(cabal haddock --enable-documentation --haddock-for-hackage|grep 'zoovisitor.*docs.tar.gz') + + echo $tar_file + echo $doc_file + + cabal upload -u "${{ secrets.HACKAGE_USERNAME }}" -p "${{ secrets.HACKAGE_PASSWORD }}" --publish $tar_file + cabal upload -u "${{ secrets.HACKAGE_USERNAME }}" -p "${{ secrets.HACKAGE_PASSWORD }}" --publush --doc $doc_file