Skip to content

Commit ed3077f

Browse files
committed
Simplify release process
This is now similar to the process used in rules_nixpkgs, releases are created from the master branch manually by triggering the `Prepare Release` workflow. This workflow creates a draft release which just needs to be published once it looks decent.
1 parent bcaa7af commit ed3077f

File tree

2 files changed

+45
-29
lines changed

2 files changed

+45
-29
lines changed

.github/ISSUE_TEMPLATE/release.md

Lines changed: 8 additions & 26 deletions
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.

.github/workflows/publish.yaml

Lines changed: 37 additions & 3 deletions
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,39 @@ 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 `cat > WORKSPACE` and `EOF`
38+
sed -i \
39+
-e '/cat > WORKSPACE/,/^EOF/{' \
40+
-e ' s%sha256 = "[^"]*"%sha256 = "${{ steps.latest.outputs.hash }}"%; ' \
41+
-e ' s%strip_prefix = "[^"]*"%strip_prefix = "rules_haskell-${{ steps.latest.outputs.version }}"%; ' \
42+
-e ' s%url = "[^"]*"%url = "https://github.com/tweag/rules_haskell/releases/download/v${{ steps.latest.outputs.version }}/rules_haskell-${{ steps.latest.outputs.version }}.tar.gz"%' \
43+
-e '}' \
44+
start
45+
# update http_archive attrs in docs between `name = "rules_haskell"` and `url = "`
46+
sed -i \
47+
-e '/name = "rules_haskell"/,/url = "/{' \
48+
-e ' s%sha256 = "[^"]*"%sha256 = "${{ steps.latest.outputs.hash }}"%; ' \
49+
-e ' s%strip_prefix = "[^"]*"%strip_prefix = "rules_haskell-${{ steps.latest.outputs.version }}"%; ' \
50+
-e ' s%url = "[^"]*"%url = "https://github.com/tweag/rules_haskell/releases/download/v${{ steps.latest.outputs.version }}/rules_haskell-${{ steps.latest.outputs.version }}.tar.gz"%; ' \
51+
-e '}' \
52+
docs/haskell-use-cases.rst
53+
- name: Commit and Push
54+
run: |
55+
if ! git diff --exit-code ; then
56+
git add start docs/haskell-use-cases.rst
57+
git commit -m "Update rules_haskell in start script and docs to version ${{ steps.latest.outputs.version }}"
58+
git push
59+
fi

0 commit comments

Comments
 (0)