-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (77 loc) · 2.52 KB
/
haskell-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
on:
workflow_call:
inputs:
ghc-version:
required: false
type: string
default: "8.10.3"
cabal-version:
required: false
type: string
default: "3.4"
secrets:
API_TOKEN_HACKAGE:
required: true
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
jobs:
docker:
runs-on: ubuntu-22.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
file: .github/docker/Dockerfile
push: true
tags: toxchat/haskell:${{ github.event.repository.name }}
hackage:
name: Publish to Hackage
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout TokTok/ci-tools
uses: actions/checkout@v4
with:
repository: TokTok/ci-tools
path: ci-tools
- uses: haskell-actions/setup@v2
with:
ghc-version: ${{ inputs.ghc-version }}
cabal-version: ${{ inputs.cabal-version }}
- name: Cache
uses: actions/cache@v4
env:
ghc-version: ${{ inputs.ghc-version }}
cache-name: cache-cabal
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ env.ghc-version }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}
restore-keys: |
${{ runner.os }}-${{ env.ghc-version }}-${{ env.cache-name }}-
${{ runner.os }}-${{ env.ghc-version }}-
- name: Install non-Haskell dependencies
run: if [ -f tools/prepare_third_party.sh ]; then tools/prepare_third_party.sh; fi
- name: Build haddock documentation
run: cabal update && cabal haddock --haddock-for-hackage --enable-doc
- name: Publish package candidate to Hackage
if: ${{ github.event_name == 'push' }}
env:
API_TOKEN_HACKAGE: ${{ secrets.API_TOKEN_HACKAGE }}
run: $GITHUB_WORKSPACE/ci-tools/bin/hackage_upload candidate
- name: Publish package to Hackage
if: ${{ github.event_name == 'release' }}
env:
API_TOKEN_HACKAGE: ${{ secrets.API_TOKEN_HACKAGE }}
run: $GITHUB_WORKSPACE/ci-tools/bin/hackage_upload