Skip to content

Commit

Permalink
Upload docs to Hackage on release
Browse files Browse the repository at this point in the history
Hackage can't build X11 because it doesn't install the required
libraries and headers (Xinerama, Xrandr, …). Therefore we need to upload
the docs ourselves.

I decided to piggyback on the haskell-ci workflow instead of having a
separate workflow as building the docs is not as trivial as the sdist.
Additionally, the sdist and haddock tarball are published as artifacts
so that people can download snapshots and we could possibly use that for
the xmonad website as well.
  • Loading branch information
liskin committed Jun 1, 2021
1 parent ac4c32c commit 46bc48c
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 34 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/hackage.yml

This file was deleted.

File renamed without changes.
63 changes: 63 additions & 0 deletions .github/workflows/haskell-ci-hackage.patch
@@ -0,0 +1,63 @@
--- .github/workflows/haskell-ci.yml.orig
+++ .github/workflows/haskell-ci.yml
@@ -14,8 +14,11 @@
#
name: Haskell-CI
on:
- - push
- - pull_request
+ push:
+ pull_request:
+ release:
+ types:
+ - published
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
@@ -28,6 +31,7 @@ jobs:
include:
- compiler: ghc-9.0.1
allow-failure: false
+ upload: true
- compiler: ghc-8.10.4
allow-failure: false
- compiler: ghc-8.8.4
@@ -171,8 +175,37 @@ jobs:
${CABAL} -vnormal check
- name: haddock
run: |
- $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
+ $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH --haddock-for-hackage --builddir $GITHUB_WORKSPACE/haddock all
- name: unconstrained build
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
+ - name: upload artifacts (sdist)
+ if: matrix.upload
+ uses: actions/upload-artifact@v2
+ with:
+ path: ${{ github.workspace }}/sdist/*.tar.gz
+ - name: upload artifacts (haddock)
+ if: matrix.upload
+ uses: actions/upload-artifact@v2
+ with:
+ path: ${{ github.workspace }}/haddock/*-docs.tar.gz
+ - name: hackage upload
+ if: matrix.upload && github.event_name == 'release'
+ run: |
+ set -ex
+ curl \
+ --silent --show-error --fail \
+ --header "Accept: text/plain" \
+ --header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
+ --form package=@$GITHUB_WORKSPACE/sdist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz \
+ https://hackage.haskell.org/packages/candidates/
+ curl \
+ --silent --show-error --fail \
+ -X PUT \
+ --header "Accept: text/plain" \
+ --header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
+ --header "Content-Type: application/x-tar" \
+ --header "Content-Encoding: gzip" \
+ --data-binary @$GITHUB_WORKSPACE/haddock/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-docs.tar.gz \
+ https://hackage.haskell.org/package/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}/candidate/docs
39 changes: 36 additions & 3 deletions .github/workflows/haskell-ci.yml
Expand Up @@ -14,8 +14,11 @@
#
name: Haskell-CI
on:
- push
- pull_request
push:
pull_request:
release:
types:
- published
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
Expand All @@ -28,6 +31,7 @@ jobs:
include:
- compiler: ghc-9.0.1
allow-failure: false
upload: true
- compiler: ghc-8.10.4
allow-failure: false
- compiler: ghc-8.8.4
Expand Down Expand Up @@ -171,8 +175,37 @@ jobs:
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH --haddock-for-hackage --builddir $GITHUB_WORKSPACE/haddock all
- name: unconstrained build
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: upload artifacts (sdist)
if: matrix.upload
uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/sdist/*.tar.gz
- name: upload artifacts (haddock)
if: matrix.upload
uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/haddock/*-docs.tar.gz
- name: hackage upload
if: matrix.upload && github.event_name == 'release'
run: |
set -ex
curl \
--silent --show-error --fail \
--header "Accept: text/plain" \
--header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
--form package=@$GITHUB_WORKSPACE/sdist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz \
https://hackage.haskell.org/packages/candidates/
curl \
--silent --show-error --fail \
-X PUT \
--header "Accept: text/plain" \
--header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
--header "Content-Type: application/x-tar" \
--header "Content-Encoding: gzip" \
--data-binary @$GITHUB_WORKSPACE/haddock/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-docs.tar.gz \
https://hackage.haskell.org/package/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}/candidate/docs
4 changes: 3 additions & 1 deletion cabal.haskell-ci
Expand Up @@ -5,7 +5,9 @@ apt:
libxrandr-dev
libxss-dev

github-patches: .github/workflows/haskell-ci.yml.patch
github-patches:
.github/workflows/haskell-ci-autoreconf.patch
.github/workflows/haskell-ci-hackage.patch

raw-project
package X11
Expand Down

0 comments on commit 46bc48c

Please sign in to comment.