|
1 | 1 | name: Release |
2 | 2 | on: workflow_dispatch |
3 | 3 |
|
| 4 | +defaults: |
| 5 | + run: |
| 6 | + shell: bash -eu -o pipefail {0} |
| 7 | + |
4 | 8 | jobs: |
| 9 | + cabal_file: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - |
| 13 | + uses: actions/checkout@v6 |
| 14 | + - |
| 15 | + uses: haskell-actions/parse-cabal-file@v1 |
| 16 | + id: cabal_file |
| 17 | + with: |
| 18 | + cabal_file: kdl-hs.cabal |
| 19 | + outputs: |
| 20 | + version: ${{ steps.cabal_file.outputs.version }} |
| 21 | + |
5 | 22 | ci: |
6 | 23 | uses: ./.github/workflows/ci.yml |
7 | 24 |
|
| 25 | + check_changelog: |
| 26 | + needs: |
| 27 | + - cabal_file |
| 28 | + runs-on: ubuntu-latest |
| 29 | + env: |
| 30 | + version: ${{ needs.cabal_file.outputs.version }} |
| 31 | + steps: |
| 32 | + - |
| 33 | + uses: actions/checkout@v6 |
| 34 | + - |
| 35 | + name: Validate CHANGELOG |
| 36 | + run: |
| 37 | + scripts/release_notes.py validate-changelog |
| 38 | + --release-version "${version}" |
| 39 | + |
8 | 40 | release: |
9 | 41 | runs-on: ubuntu-latest |
10 | 42 | needs: |
| 43 | + - cabal_file |
11 | 44 | - ci |
| 45 | + - check_changelog |
| 46 | + |
| 47 | + env: |
| 48 | + version: ${{ needs.cabal_file.outputs.version }} |
12 | 49 |
|
13 | 50 | steps: |
14 | 51 | - |
15 | | - uses: actions/checkout@v3 |
| 52 | + uses: actions/checkout@v6 |
16 | 53 | - |
17 | 54 | uses: actions/download-artifact@v4 |
18 | 55 | with: |
19 | 56 | name: kdl-sdist |
20 | | - path: ./sdist/ |
21 | | - - |
22 | | - id: cabal_file |
23 | | - uses: haskell-actions/parse-cabal-file@v1 |
24 | | - with: |
25 | | - cabal_file: kdl-hs.cabal |
26 | | - - |
27 | | - name: Set version label |
28 | | - run: echo 'VERSION=v${{ steps.cabal_file.outputs.version }}' >> "${GITHUB_ENV}" |
| 57 | + path: ./.release/sdist/ |
29 | 58 | - |
30 | 59 | id: hackage_token_secret |
31 | 60 | name: Load Hackage token secret name |
32 | 61 | run: | |
33 | 62 | USERNAME="$(echo "${GITHUB_ACTOR}" | tr '[:lower:]' '[:upper:]' | tr '-' '_')" |
34 | 63 | echo "name=HACKAGE_TOKEN_${USERNAME}" >> "${GITHUB_OUTPUT}" |
35 | 64 | - |
36 | | - name: Get CHANGELOG section |
37 | | - run: | |
38 | | - sed '/^## Unreleased/,/^$/d' CHANGELOG.md > /tmp/changelog-without-unreleased |
39 | | - if [[ "$(head -n 1 /tmp/changelog-without-unreleased)" != "## ${VERSION}" ]]; then |
40 | | - echo "CHANGELOG doesn't look updated" >&2 |
41 | | - exit 1 |
42 | | - fi |
43 | | - sed '1 d; /^## v/,$ d' /tmp/changelog-without-unreleased > /tmp/changelog-body |
| 65 | + name: Generate release notes |
| 66 | + run: |
| 67 | + scripts/release_notes.py generate |
| 68 | + --release-version "${version}" |
| 69 | + | tee .release/release-notes.md |
44 | 70 | - |
45 | 71 | uses: haskell-actions/hackage-publish@v1 |
46 | 72 | with: |
47 | 73 | hackageToken: ${{ secrets[steps.hackage_token_secret.outputs.name] }} |
48 | | - packagesPath: ./sdist/ |
| 74 | + packagesPath: ./.release/sdist/ |
49 | 75 | - |
50 | 76 | uses: softprops/action-gh-release@v1 |
51 | 77 | with: |
52 | | - tag_name: ${{ env.VERSION }} |
53 | | - body_path: /tmp/changelog-body |
| 78 | + tag_name: v${{ env.version }} |
| 79 | + body_path: .release/release-notes.md |
54 | 80 | draft: true |
55 | 81 | target_commitish: ${{ github.sha }} |
0 commit comments