Skip to content

Commit

Permalink
Upload Haddocks from GitHub
Browse files Browse the repository at this point in the history
Since implementing Kafka functionality, Hackage has been unable to build
our Haddocks due to the system library requirement that introduced.
Since then, we've been sporadically uploading docs using the
`docs/upload` script, which relied on (nix and) cabal to use its
`--haddock-for-hackage` flag.

With the release of stack-v2.15, we can now:

- Use its new `--haddock --haddock-for-hackage` options
- Use the new `stack upload -d` option
- Use `HACKAGE_KEY` to authorize `stack` for uploads

So we can do all of this on CI, without incurring the need to use cabal
instead of Stack there. We also don't really need `stack-upload-action`
anymore, so that's been removed.

I decided to add an additional build within `release.yml`, rather than:

1. Conditionally release from `ci.yml` after building, or
2. Attempting to upload artifacts from `ci.yml` for use in `release.yml`

The reason for this is:

- It made this the simplest change to accomplish the goal
- It's somewhat valuable to add a requirement the thing builds before
  releasing, which wasn't the case before
- The addition of Haddocks makes the build 23m cached-or-not, which we
  don't want to do except during release, and is fine to do post-merge,
  which is not holding anyone up
  • Loading branch information
pbrisbin committed Feb 20, 2024
1 parent c75dc6f commit 3988950
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install rdkafka
run: sudo apt-get install --assume-yes --no-install-recommends librdkafka-dev
- uses: freckle/stack-action@v4
- uses: freckle/stack-action@v5
with:
stack-yaml: ${{ matrix.stack-yaml }}
env:
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell/actions/hlint-setup@v2
- uses: haskell/actions/hlint-run@v2
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: warning
28 changes: 20 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@ on:
branches: main

jobs:
release:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v4
- id: tag
uses: freckle/haskell-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
tag: ${{ steps.tag.outputs.tag }}

release:
needs: tag
if: needs.tag.outputs.tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install --assume-yes --no-install-recommends librdkafka-dev
- uses: freckle/stack-action@v5
with:
test: false
stack-build-arguments: --haddock --haddock-for-hackage

- if: steps.tag.outputs.tag
uses: freckle/stack-upload-action@v2
- run: |
stack --stack-yaml stack-lts-18.28.yaml upload --pvp-bounds lower .
stack upload --documentation .
env:
HACKAGE_API_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }}
HACKAGE_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }}
26 changes: 0 additions & 26 deletions docs/upload

This file was deleted.

0 comments on commit 3988950

Please sign in to comment.