CI: GitHub MacOS runners lost ghcup since 2024-04-27, so use haskell-action/setup...
[cabal.git] / .github / workflows / changelogs.yml
blob922c0cf46f9a0e85cf3350a54ea03f8245f6faea
1 name: Changelogs
3 on:
4   push:
5     branches:
6     - master
7     paths:
8     - 'changelog.d/*'
9     - '.github/workflows/changelogs.yml'
10   pull_request:
11     paths:
12     - 'changelog.d/*'
13     - '.github/workflows/changelogs.yml'
14   release:
15     types:
16       - created
18 defaults:
19   run:
20     shell: bash
22 jobs:
23   build:
24     name: Changelogs
25     runs-on: ubuntu-latest
27     steps:
29       # Cannot install changelog-d directly from remote tarball due to
30       # https://github.com/haskell/cabal/issues/7360
31       # Also, we would like to get the build plan for the cache key.
32       - name: Fetch changelog-d
33         run: |
34           changelog_d_latest="$(curl https://codeberg.org/api/v1/repos/fgaz/changelog-d/branches/master | jq -r .commit.id)"
35           echo "Using changelog-d revision $changelog_d_latest"
36           curl "https://codeberg.org/fgaz/changelog-d/archive/$changelog_d_latest.tar.gz" -o changelog-d.tar.gz
37           tar -xf changelog-d.tar.gz
39       - name: Update Hackage index
40         run: cabal v2-update
42       - name: Build plan for changelog-d
43         working-directory: changelog-d
44         run: |
45           cabal v2-build --dry-run --allow-newer=changelog-d:base
47       - name: Restore dependencies of changelog-d
48         uses: actions/cache/restore@v4
49         id: cache
50         with:
51           path: ~/.local/state/cabal
52           key: linux-store-changelogs-${{ hashfiles('changelog-d/dist-newstyle/cache/plan.json') }}
53           restore-keys: linux-store-changelogs
55       - name: Install changelog-d
56         working-directory: changelog-d
57         run: |
58           cabal v2-install --allow-newer=changelog-d:base
60       - name: Cache dependencies of changelog-d
61         uses: actions/cache/save@v4
62         if: always() && steps.cache.outputs.cache-hit != 'true'
63         with:
64           path: ~/.local/state/cabal
65           key: ${{ steps.cache.outputs.cache-primary-key }}
67       - name: Checkout cabal sources
68         uses: actions/checkout@v4
70       - name: Run changelog-d
71         run: |
72           changelog-d changelog.d