Skip to content

Commit b59dc1e

Browse files
authored
Merge pull request #2024 from tweag/refine-release-workflow
Add tar.gz archive to each release
2 parents dacc6f0 + f1368ef commit b59dc1e

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

.github/workflows/prepare-release.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@ 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
15+
- name: Create archive
16+
id: archive
17+
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
1728
- name: Generate changelog
1829
run: |
1930
printf '\n-----\n\n' >> release_notes.txt
@@ -23,3 +34,5 @@ jobs:
2334
with:
2435
draft: true
2536
body_path: release_notes.txt
37+
fail_on_unmatched_files: true
38+
files: ${{ steps.archive.outputs.tgz }}

.github/workflows/workspace_snippet.sh renamed to .github/workflows/prepare_snippets.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)