Add CI workflow step to publish on Hackage on tag push (#196)

* Barebones `hackage.yml` workflow structure

* Removed `hackage.yml`

* Added new `release` job and steps for Hackage distribution

* Commenting `release` job

* Uncommented `release` job and fixed bad syntax

* Fixed bad YAML syntax

* Removed upload-artifact/download-artifact

* Changed version variable to glob expression `*`

* Added Haddock generation and upload steps for Hackage
This commit is contained in:
David Mazarro 2022-05-20 10:16:41 +02:00 committed by GitHub
parent 0e4bef339b
commit f973b0671e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
# - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml
# - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml
# - https://markkarpov.com/post/github-actions-for-haskell-ci.html
# - https://github.com/tfausak/strive/blob/main/.github/workflows/ci.yaml
# - https://hackage.haskell.org/upload
---
name: CI
@ -51,3 +53,28 @@ jobs:
- run: cabal build
- run: cabal test
- run: ./script/haddock
release:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Generate package ready for Hackage distribution
run: cabal sdist
- name: Upload package to Hackage
run: |
cabal upload --publish \
--username '${{ secrets.HACKAGE_USERNAME }}' \
--password '${{ secrets.HACKAGE_PASSWORD }}' \
dist-newstyle/sdist/hapistrano-*.tar.gz
- name: Generate Haddock docs for Hackage distribution
run: cabal v2-haddock --haddock-for-hackage --enable-doc
- name: Upload Haddock docs to Hackage
run: |
cabal upload -d --publish \
--username '${{ secrets.HACKAGE_USERNAME }}' \
--password '${{ secrets.HACKAGE_PASSWORD }}' \
dist-newstyle/hapistrano-*-docs.tar.gz