Skip to content

Commit 46bc48c

Browse files
committed
Upload docs to Hackage on release
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.
1 parent ac4c32c commit 46bc48c

File tree

5 files changed

+102
-34
lines changed

5 files changed

+102
-34
lines changed

.github/workflows/hackage.yml

-30
This file was deleted.
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--- .github/workflows/haskell-ci.yml.orig
2+
+++ .github/workflows/haskell-ci.yml
3+
@@ -14,8 +14,11 @@
4+
#
5+
name: Haskell-CI
6+
on:
7+
- - push
8+
- - pull_request
9+
+ push:
10+
+ pull_request:
11+
+ release:
12+
+ types:
13+
+ - published
14+
jobs:
15+
linux:
16+
name: Haskell-CI - Linux - ${{ matrix.compiler }}
17+
@@ -28,6 +31,7 @@ jobs:
18+
include:
19+
- compiler: ghc-9.0.1
20+
allow-failure: false
21+
+ upload: true
22+
- compiler: ghc-8.10.4
23+
allow-failure: false
24+
- compiler: ghc-8.8.4
25+
@@ -171,8 +175,37 @@ jobs:
26+
${CABAL} -vnormal check
27+
- name: haddock
28+
run: |
29+
- $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
30+
+ $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH --haddock-for-hackage --builddir $GITHUB_WORKSPACE/haddock all
31+
- name: unconstrained build
32+
run: |
33+
rm -f cabal.project.local
34+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
35+
+ - name: upload artifacts (sdist)
36+
+ if: matrix.upload
37+
+ uses: actions/upload-artifact@v2
38+
+ with:
39+
+ path: ${{ github.workspace }}/sdist/*.tar.gz
40+
+ - name: upload artifacts (haddock)
41+
+ if: matrix.upload
42+
+ uses: actions/upload-artifact@v2
43+
+ with:
44+
+ path: ${{ github.workspace }}/haddock/*-docs.tar.gz
45+
+ - name: hackage upload
46+
+ if: matrix.upload && github.event_name == 'release'
47+
+ run: |
48+
+ set -ex
49+
+ curl \
50+
+ --silent --show-error --fail \
51+
+ --header "Accept: text/plain" \
52+
+ --header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
53+
+ --form package=@$GITHUB_WORKSPACE/sdist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz \
54+
+ https://hackage.haskell.org/packages/candidates/
55+
+ curl \
56+
+ --silent --show-error --fail \
57+
+ -X PUT \
58+
+ --header "Accept: text/plain" \
59+
+ --header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
60+
+ --header "Content-Type: application/x-tar" \
61+
+ --header "Content-Encoding: gzip" \
62+
+ --data-binary @$GITHUB_WORKSPACE/haddock/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-docs.tar.gz \
63+
+ https://hackage.haskell.org/package/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}/candidate/docs

.github/workflows/haskell-ci.yml

+36-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#
1515
name: Haskell-CI
1616
on:
17-
- push
18-
- pull_request
17+
push:
18+
pull_request:
19+
release:
20+
types:
21+
- published
1922
jobs:
2023
linux:
2124
name: Haskell-CI - Linux - ${{ matrix.compiler }}
@@ -28,6 +31,7 @@ jobs:
2831
include:
2932
- compiler: ghc-9.0.1
3033
allow-failure: false
34+
upload: true
3135
- compiler: ghc-8.10.4
3236
allow-failure: false
3337
- compiler: ghc-8.8.4
@@ -171,8 +175,37 @@ jobs:
171175
${CABAL} -vnormal check
172176
- name: haddock
173177
run: |
174-
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
178+
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH --haddock-for-hackage --builddir $GITHUB_WORKSPACE/haddock all
175179
- name: unconstrained build
176180
run: |
177181
rm -f cabal.project.local
178182
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
183+
- name: upload artifacts (sdist)
184+
if: matrix.upload
185+
uses: actions/upload-artifact@v2
186+
with:
187+
path: ${{ github.workspace }}/sdist/*.tar.gz
188+
- name: upload artifacts (haddock)
189+
if: matrix.upload
190+
uses: actions/upload-artifact@v2
191+
with:
192+
path: ${{ github.workspace }}/haddock/*-docs.tar.gz
193+
- name: hackage upload
194+
if: matrix.upload && github.event_name == 'release'
195+
run: |
196+
set -ex
197+
curl \
198+
--silent --show-error --fail \
199+
--header "Accept: text/plain" \
200+
--header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
201+
--form package=@$GITHUB_WORKSPACE/sdist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz \
202+
https://hackage.haskell.org/packages/candidates/
203+
curl \
204+
--silent --show-error --fail \
205+
-X PUT \
206+
--header "Accept: text/plain" \
207+
--header "Authorization: X-ApiKey ${{ secrets.HACKAGE_API_KEY }}" \
208+
--header "Content-Type: application/x-tar" \
209+
--header "Content-Encoding: gzip" \
210+
--data-binary @$GITHUB_WORKSPACE/haddock/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-docs.tar.gz \
211+
https://hackage.haskell.org/package/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}/candidate/docs

cabal.haskell-ci

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ apt:
55
libxrandr-dev
66
libxss-dev
77

8-
github-patches: .github/workflows/haskell-ci.yml.patch
8+
github-patches:
9+
.github/workflows/haskell-ci-autoreconf.patch
10+
.github/workflows/haskell-ci-hackage.patch
911

1012
raw-project
1113
package X11

0 commit comments

Comments
 (0)