Skip to content

Commit

Permalink
Simplify release process
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
avdv committed Sep 23, 2024
1 parent 0a6cb46 commit cc91252
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 29 deletions.
34 changes: 8 additions & 26 deletions .github/ISSUE_TEMPLATE/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,15 @@ about: Steps to work through in order to publish a new release
- [ ] Create "Added", "Removed", "Changed" and "Fixed" sections, as
necessary.
- [ ] If relevant, add links to the corresponding PRs to the entries.
- [ ] Set the revision in [the `start` script][start] and
[`docs/haskell-use-cases`][usecases] to the current release
preparation branch; comment out the checksum. (n.b., Search for
`http_archive` in these files.)
- [ ] Update the version of the modules in `MODULE.bazel` files
- [ ] Push the `release-<major>.<minor>` branch and open a **draft** PR
to verify CI is green.
- [ ] Create a release tag (`v<major>.<minor>`) on the release
preparation branch and push the tag; or use Github's UI.
- [ ] Go to the [release page][releases]:
- [ ] Open the corresponding draft release and copy the workspace snippet.
- [ ] Insert the workspace snippet into [the `start` script][start]
and [`docs/haskell-use-cases`][usecases] replacing the existing snippet.
- [ ] Push the changes to the remote branch and mark the PR as ready;
go through review and merge to `master` upon success.
- If any changes need to be made, upon review, you will need to delete
the release tag (from local and origin) and repeat the previous four
steps appropriately before requesting a follow-up review.
- If there are changes on the release preparation branch that should
*not* go to `master`, create a second branch
`release-<major>.<minor>-master` on `master` and cherry-pick all
relevant commits from the release branch preparation branch. Open a
pull request with that branch, go through review and push changes
back to the release preparation branch.
- [ ] Go to the [release page][releases]:
- [ ] Open the draft release for the current version.
- [ ] Release.
- [ ] Push the `release-<major>.<minor>` branch and open a PR; go through review and merge upon success.
- [ ] Trigger the `Prepare Release` workflow
- either via the Github UI **or**
- run `gh workflow run -f version=<major>.<minor> 'Prepare Release'` using the Github CLI
- [ ] Go to the [releases], open the draft release which was created to inspect it
- Do the code snippets look valid?
- Is there a release artifact attached to it?
- If you're happy, publish the release... :rocket:
- [ ] After the "Publish" workflow is finished check whether https://haskell.build/start
is now the latest [`start` script][start] (Netlify sometimes has problems).
- [ ] Announce the new version on Twitter by asking someone with access.
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish

on:
release:
types: [published]
types: [released]
workflow_dispatch: # allows manual triggering

jobs:
Expand All @@ -21,5 +21,32 @@ jobs:
git config user.email [email protected]
- name: Merge master into release
run: git merge --no-edit origin/master
- name: Push
run: git push
- name: Fetch latest release artifact
id: latest
run: |
gh release download -p '*.tar.gz' -D release
ls release | sed -ne 's/rules_haskell-\(.*\)[.]tar[.]gz/version=\1/p' >> "${GITHUB_OUTPUT}"
shasum -a 256 release/*.tar.gz | awk '{print "hash=" $1}' >> "${GITHUB_OUTPUT}"
- name: Update hash in start script and docs
run: |
sed -ie '/bazel_dep(name = "rules_haskell"/s/version = "[^"]*"/version = "${{ steps.latest.outputs.version }}"/' start
sed -i \
-e '/cat > WORKSPACE/,/^EOF/{' \
-e ' s%sha256 = "[^"]*"%sha256 = "${{ steps.latest.outputs.hash }}"%; ' \
-e ' s%strip_prefix = "[^"]*"%strip_prefix = "rules_haskell-${{ steps.latest.outputs.version }}"%; ' \
-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"%' \
-e '}' \
start
sed -i \
-e '/name = "rules_haskell"/,/url = "/{' \
-e ' s%sha256 = "[^"]*"%sha256 = "${{ steps.latest.outputs.hash }}"%; ' \
-e ' s%strip_prefix = "[^"]*"%strip_prefix = "rules_haskell-${{ steps.latest.outputs.version }}"%; ' \
-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"%; ' \
-e '}' \
docs/haskell-use-cases.rst
- name: Commit and Push
run: |
git diff
git add start docs/haskell-use-cases.rst
git commit -m "Update rules_haskell in start script and docs to version ${{ steps.latest.outputs.version }}"
git push

0 comments on commit cc91252

Please sign in to comment.