Skip to content

Commit a361943

Browse files
authored
Merge pull request #2248 from tweag/cb/prepare-release
Prepare release 1.0 🚀
2 parents ad698b6 + 5f64603 commit a361943

File tree

22 files changed

+172
-121
lines changed

22 files changed

+172
-121
lines changed

.bazelci/presubmit.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
---
22
matrix:
3+
bazel:
4+
- 6.x
5+
- 7.x
36
workdir: [".", "rules_haskell_tests"]
47

58
tasks:
69
ubuntu1804:
10+
bazel: ${{ bazel }}
711
working_directory: ${{ workdir }}
812
platform: "ubuntu1804"
913
environment:

.bcr/presubmit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ matrix:
99
#- windows
1010
bazel:
1111
- 6.x
12+
- 7.x
1213
tasks:
1314
verify_targets:
1415
name: Verify build targets
@@ -31,7 +32,6 @@ tasks:
3132
- 'powershell -Command "Invoke-WebRequest -Uri https://hackage.haskell.org/root.json -OutFile out.json"'
3233
build_flags:
3334
- '--incompatible_enable_cc_toolchain_resolution'
34-
- '--repo_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1'
3535
build_targets:
3636
- '@rules_haskell//haskell/...'
3737
- '@rules_haskell//tools/...'

.github/ISSUE_TEMPLATE/release.md

+8-26
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,15 @@ about: Steps to work through in order to publish a new release
2323
- [ ] Create "Added", "Removed", "Changed" and "Fixed" sections, as
2424
necessary.
2525
- [ ] If relevant, add links to the corresponding PRs to the entries.
26-
- [ ] Set the revision in [the `start` script][start] and
27-
[`docs/haskell-use-cases`][usecases] to the current release
28-
preparation branch; comment out the checksum. (n.b., Search for
29-
`http_archive` in these files.)
3026
- [ ] Update the version of the modules in `MODULE.bazel` files
31-
- [ ] Push the `release-<major>.<minor>` branch and open a **draft** PR
32-
to verify CI is green.
33-
- [ ] Create a release tag (`v<major>.<minor>`) on the release
34-
preparation branch and push the tag; or use Github's UI.
35-
- [ ] Go to the [release page][releases]:
36-
- [ ] Open the corresponding draft release and copy the workspace snippet.
37-
- [ ] Insert the workspace snippet into [the `start` script][start]
38-
and [`docs/haskell-use-cases`][usecases] replacing the existing snippet.
39-
- [ ] Push the changes to the remote branch and mark the PR as ready;
40-
go through review and merge to `master` upon success.
41-
- If any changes need to be made, upon review, you will need to delete
42-
the release tag (from local and origin) and repeat the previous four
43-
steps appropriately before requesting a follow-up review.
44-
- If there are changes on the release preparation branch that should
45-
*not* go to `master`, create a second branch
46-
`release-<major>.<minor>-master` on `master` and cherry-pick all
47-
relevant commits from the release branch preparation branch. Open a
48-
pull request with that branch, go through review and push changes
49-
back to the release preparation branch.
50-
- [ ] Go to the [release page][releases]:
51-
- [ ] Open the draft release for the current version.
52-
- [ ] Release.
27+
- [ ] Push the `release-<major>.<minor>` branch and open a PR; go through review and merge upon success.
28+
- [ ] Trigger the `Prepare Release` workflow
29+
- either via the Github UI **or**
30+
- run `gh workflow run -f version=<major>.<minor> 'Prepare Release'` using the Github CLI
31+
- [ ] Go to the [releases], open the draft release which was created to inspect it
32+
- Do the code snippets look valid?
33+
- Is there a release artifact attached to it?
34+
- If you're happy, publish the release... :rocket:
5335
- [ ] After the "Publish" workflow is finished check whether https://haskell.build/start
5436
is now the latest [`start` script][start] (Netlify sometimes has problems).
5537
- [ ] Announce the new version on Twitter by asking someone with access.
+41-28
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,51 @@
1-
name: Prepare release
1+
# Create a draft release when triggered via Github's UI or Github CLI
2+
name: Prepare Release
23

34
on:
4-
push:
5-
tags:
6-
- "v[0-9]*.[0-9]*"
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version to release (e.g. 0.11.0)'
9+
required: true
10+
type: string
11+
12+
permissions:
13+
contents: write
714

815
jobs:
9-
update-release-notes:
10-
name: Update release
16+
release:
17+
name: Prepare Release
1118
runs-on: ubuntu-latest
1219
steps:
20+
- name: Check version
21+
run: |
22+
if ! [[ '${{ inputs.version }}' =~ ^[0-9]+[.][0-9]+([.][0-9]+)?$ ]]; then
23+
echo '${{ inputs.version }} does not match expected format `major.minor.patch?`' >&2
24+
exit 1
25+
fi
1326
- name: Checkout
1427
uses: actions/checkout@v4
15-
- name: Create archive
16-
id: archive
28+
with:
29+
ref: master # only create releases from main branch
30+
- name: Read section from CHANGELOG.md
31+
id: extract-changelog
32+
uses: sean0x42/markdown-extract@v2
33+
with:
34+
file: CHANGELOG.md
35+
pattern: ${{ inputs.version }}
36+
- name: Prepare release notes and artifacts
1737
run: |
18-
TAG="${GITHUB_REF_NAME}"
19-
REPOSITORY_NAME="${GITHUB_REPOSITORY#*/}"
20-
PREFIX="${REPOSITORY_NAME}-${TAG:1}"
21-
ARCHIVE="${PREFIX}.tar.gz"
22-
23-
echo "tgz=${ARCHIVE}" >> $GITHUB_OUTPUT
24-
25-
git archive --format=tar.gz --prefix="${PREFIX}/" -o "$ARCHIVE" "${TAG}"
26-
- name: Prepare bzlmod / WORKSPACE snippets
27-
run: .github/workflows/prepare_snippets.sh ${{ steps.archive.outputs.tgz }} > release_notes.txt
28-
- name: Generate changelog
38+
.github/workflows/release_prep.sh v${{ inputs.version }} > release_notes.txt
39+
printf '${{ steps.extract-changelog.outputs.markdown }}' >> release_notes.txt
40+
- name: Create draft release
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2943
run: |
30-
printf '\n-----\n\n' >> release_notes.txt
31-
awk -f .github/workflows/changelog.awk CHANGELOG.md >> release_notes.txt
32-
- name: Release
33-
uses: softprops/action-gh-release@v2
34-
with:
35-
draft: true
36-
body_path: release_notes.txt
37-
fail_on_unmatched_files: true
38-
files: ${{ steps.archive.outputs.tgz }}
44+
gh release create \
45+
--draft \
46+
--notes-file release_notes.txt \
47+
--title v${{ inputs.version }} \
48+
v${{ inputs.version }} \
49+
${GITHUB_REPOSITORY#*/}-${{ inputs.version }}.tar.gz | tee release_url
50+
- name: Write summary
51+
run: 'echo ":rocket: Draft release created [here]($( cat release_url ))" >> "${GITHUB_STEP_SUMMARY}"'

.github/workflows/prepare_snippets.sh

-40
This file was deleted.

.github/workflows/publish.yaml

+28-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish
22

33
on:
44
release:
5-
types: [published]
5+
types: [released]
66
workflow_dispatch: # allows manual triggering
77

88
jobs:
@@ -21,5 +21,30 @@ jobs:
2121
git config user.email [email protected]
2222
- name: Merge master into release
2323
run: git merge --no-edit origin/master
24-
- name: Push
25-
run: git push
24+
- name: Fetch latest release artifact
25+
id: latest
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
run: |
29+
gh release download -p '*.tar.gz' -D release
30+
ls release | sed -ne 's/rules_haskell-\(.*\)[.]tar[.]gz/version=\1/p' >> "${GITHUB_OUTPUT}"
31+
shasum -a 256 release/*.tar.gz | awk '{print "hash=" $1}' >> "${GITHUB_OUTPUT}"
32+
- name: Update hash in start script and docs
33+
run: |
34+
sed -i \
35+
-e '/bazel_dep(name = "rules_haskell"/s/version = "[^"]*"/version = "${{ steps.latest.outputs.version }}"/' \
36+
start
37+
# update http_archive attrs between `name = "rules_haskell"` and `url = "`
38+
sed -i \
39+
-e '/name = "rules_haskell"/,/url = "/{' \
40+
-e ' s%x\{64\}%${{ steps.latest.outputs.hash }}%; ' \
41+
-e ' s%M[.]NN%${{ steps.latest.outputs.version }}%g ' \
42+
-e '}' \
43+
start docs/haskell-use-cases.rst
44+
- name: Commit and Push
45+
run: |
46+
if ! git diff --exit-code ; then
47+
git add start docs/haskell-use-cases.rst
48+
git commit -m "Update rules_haskell in start script and docs to version ${{ steps.latest.outputs.version }}"
49+
git push
50+
fi

.github/workflows/release_prep.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
TAG=$1
5+
REPO_NAME=${GITHUB_REPOSITORY#*/}
6+
# The prefix is chosen to match what GitHub generates for source archives
7+
PREFIX="${REPO_NAME}-${TAG:1}"
8+
ARCHIVE="${REPO_NAME}-${TAG:1}.tar.gz"
9+
git archive --format=tar.gz --prefix="${PREFIX}/" -o $ARCHIVE HEAD
10+
SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}')
11+
12+
cat << EOF
13+
## Using Bzlmod with Bazel 6+
14+
15+
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
16+
2. Add to your \`MODULE.bazel\` file:
17+
18+
\`\`\`starlark
19+
bazel_dep(name = "${REPO_NAME}", version = "${TAG:1}")
20+
\`\`\`
21+
22+
## Using WORKSPACE
23+
24+
Paste this snippet into your \`WORKSPACE.bazel\` file:
25+
26+
\`\`\`starlark
27+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
28+
29+
http_archive(
30+
name = "${REPO_NAME}",
31+
sha256 = "${SHA}",
32+
strip_prefix = "$PREFIX",
33+
urls = ["https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/$ARCHIVE"],
34+
)
35+
36+
load("@${REPO_NAME}//haskell:repositories.bzl", "${REPO_NAME}_dependencies")
37+
38+
${REPO_NAME}_dependencies()
39+
\`\`\`
40+
EOF

CHANGELOG.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,41 @@
33
All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/).
6-
## Next release
6+
7+
## [1.0] 2024-09-23
8+
9+
[1.0]: https://github.com/tweag/rules_haskell/compare/v0.19...v1.0
10+
11+
### Highlights
12+
13+
* Support for Bazel 7 (see https://github.com/tweag/rules_haskell/pull/2232)
14+
* Support for GHC 9.8.x (see https://github.com/tweag/rules_haskell/pull/2132)
15+
16+
### Added
17+
18+
* Support for unit-based hie-bios script for ghc 9.4+ (See https://github.com/tweag/rules_haskell/pull/2218)
19+
* Preliminary support for GHC 9.10.x (See https://github.com/tweag/rules_haskell/pull/2198)
20+
21+
### Fixed
22+
23+
* Handle RTS library for GHC 9.4+ (See https://github.com/tweag/rules_haskell/pull/2202)
24+
* Error when building cabal sub-libraries (See https://github.com/tweag/rules_haskell/pull/2135)
725

826
### Changed
927

1028
* Use ghc 9.4.6 by default
1129
* Use Bazel 6.5.0 by default (See https://github.com/tweag/rules_haskell/pull/2117)
30+
* Update nixpkgs revision to nixos-24.05,
31+
**note***: requires rules\_nixpkgs version >= 0.12 (See https://github.com/tweag/rules_haskell/pull/2217)
32+
* Asterius is deprecated and not tested anymore (See https://github.com/tweag/rules_haskell/pull/2182)
33+
* No longer create empty libraries (See https://github.com/tweag/rules_haskell/pull/2158)
34+
* Make static linking of haskell_cabal_binary explicit (See https://github.com/tweag/rules_haskell/pull/2148)
35+
36+
### Removed
37+
38+
* Testing GHC 9.2.x on CI
1239

13-
## [0.19] 2024-02-5
40+
## [0.19] 2024-02-07
1441

1542
[0.19]: https://github.com/tweag/rules_haskell/compare/v0.18...v0.19
1643

MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module(
22
name = "rules_haskell",
3-
version = "0.19",
3+
version = "1.0",
44
)
55

66
bazel_dep(

docs/haskell-use-cases.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ rules_haskell. To use a released version, do the following::
2828

2929
http_archive(
3030
name = "rules_haskell",
31-
sha256 = "34742848a8882d94a0437b3b1917dea6f58c82fe5762afe8d249d3a36e51935d",
32-
strip_prefix = "rules_haskell-0.19",
33-
url = "https://github.com/tweag/rules_haskell/releases/download/v0.19/rules_haskell-0.19.tar.gz",
31+
sha256 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
32+
strip_prefix = "rules_haskell-M.NN",
33+
url = "https://github.com/tweag/rules_haskell/releases/download/vM.NN/rules_haskell-M.NN.tar.gz",
3434
)
3535

3636
Picking a compiler

examples/MODULE.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ bazel_dep(
99
)
1010
bazel_dep(
1111
name = "rules_haskell_nix",
12-
version = "0.19",
12+
version = "1.0",
1313
)
1414
bazel_dep(
1515
name = "rules_haskell",
16-
version = "0.19",
16+
version = "1.0",
1717
)
1818

1919
# TODO
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"homepage": "",
33
"maintainers": [],
4-
"versions": ["0.19"],
4+
"versions": ["1.0"],
55
"yanked_versions": []
66
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"homepage": "",
33
"maintainers": [],
4-
"versions": ["0.19"],
4+
"versions": ["1.0"],
55
"yanked_versions": []
66
}

rules_haskell_nix/MODULE.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module(
22
name = "rules_haskell_nix",
3-
version = "0.19",
3+
version = "1.0",
44
)
55

66
bazel_dep(
77
name = "rules_haskell",
8-
version = "0.19",
8+
version = "1.0",
99
)
1010
bazel_dep(
1111
name = "rules_sh",

0 commit comments

Comments
 (0)