Skip to content

Commit c3eb8f2

Browse files
committed
Refine release preparation step
* use release artifact URL for WORKSPACE snippet * add bzlmod MODULE.bazel snippet to release body
1 parent b67d4b3 commit c3eb8f2

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

.github/workflows/prepare-release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ jobs:
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v4
15-
- name: Prepare workspace snippet
16-
run: .github/workflows/workspace_snippet.sh > release_notes.txt
17-
- name: Generate changelog
18-
run: |
19-
printf '\n-----\n\n' >> release_notes.txt
20-
awk -f .github/workflows/changelog.awk CHANGELOG.md >> release_notes.txt
2115
- name: Create archive
2216
id: archive
2317
run: |
@@ -29,6 +23,12 @@ jobs:
2923
echo "tgz=${ARCHIVE}" >> $GITHUB_OUTPUT
3024
3125
git archive --format=tar.gz --prefix="${PREFIX}/" -o "$ARCHIVE" "${TAG}"
26+
- name: Prepare workspace snippet
27+
run: .github/workflows/workspace_snippet.sh ${{ steps.archive.outputs.tgz }} > release_notes.txt
28+
- name: Generate changelog
29+
run: |
30+
printf '\n-----\n\n' >> release_notes.txt
31+
awk -f .github/workflows/changelog.awk CHANGELOG.md >> release_notes.txt
3232
- name: Release
3333
uses: softprops/action-gh-release@v1
3434
with:

.github/workflows/workspace_snippet.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,32 @@
22

33
set -o errexit -o nounset -o pipefail
44

5+
ARCHIVE="$1"
6+
57
# Set by GH actions, see
68
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
79
TAG=${GITHUB_REF_NAME}
810
REPO_NAME=${GITHUB_REPOSITORY#*/}
911
PREFIX="${REPO_NAME}-${TAG:1}"
10-
URL="https://github.com/${GITHUB_REPOSITORY}/archive/refs/tags/${TAG}.tar.gz"
12+
URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/$TAG/$ARCHIVE"
1113

12-
if ! SHA=$( curl -sfL "${URL}" | shasum -a 256 | awk '{print $1}'); then
13-
echo "error: could not determine hash for ${URL}" >&2
14+
if ! SHA=$( shasum -a 256 "$ARCHIVE" | awk '{print $1}'); then
15+
echo "error: could not determine hash for ${ARCHIVE}" >&2
1416
exit 1
1517
fi
1618

1719
cat << EOF
18-
WORKSPACE snippet:
20+
## Using bzlmod with Bazel 6
21+
22+
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
23+
2. Add to your \`MODULE.bazel\` file:
24+
25+
\`\`\`starlark
26+
bazel_dep(name = "rules_haskell", version = "${TAG:1}")
27+
\`\`\`
28+
29+
## Using WORKSPACE
30+
1931
\`\`\`starlark
2032
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2133
http_archive(

0 commit comments

Comments
 (0)