-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2248 from tweag/cb/prepare-release
Prepare release 1.0 🚀
- Loading branch information
Showing
22 changed files
with
172 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,51 @@ | ||
name: Prepare release | ||
# Create a draft release when triggered via Github's UI or Github CLI | ||
name: Prepare Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]*.[0-9]*" | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to release (e.g. 0.11.0)' | ||
required: true | ||
type: string | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update-release-notes: | ||
name: Update release | ||
release: | ||
name: Prepare Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check version | ||
run: | | ||
if ! [[ '${{ inputs.version }}' =~ ^[0-9]+[.][0-9]+([.][0-9]+)?$ ]]; then | ||
echo '${{ inputs.version }} does not match expected format `major.minor.patch?`' >&2 | ||
exit 1 | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Create archive | ||
id: archive | ||
with: | ||
ref: master # only create releases from main branch | ||
- name: Read section from CHANGELOG.md | ||
id: extract-changelog | ||
uses: sean0x42/markdown-extract@v2 | ||
with: | ||
file: CHANGELOG.md | ||
pattern: ${{ inputs.version }} | ||
- name: Prepare release notes and artifacts | ||
run: | | ||
TAG="${GITHUB_REF_NAME}" | ||
REPOSITORY_NAME="${GITHUB_REPOSITORY#*/}" | ||
PREFIX="${REPOSITORY_NAME}-${TAG:1}" | ||
ARCHIVE="${PREFIX}.tar.gz" | ||
echo "tgz=${ARCHIVE}" >> $GITHUB_OUTPUT | ||
git archive --format=tar.gz --prefix="${PREFIX}/" -o "$ARCHIVE" "${TAG}" | ||
- name: Prepare bzlmod / WORKSPACE snippets | ||
run: .github/workflows/prepare_snippets.sh ${{ steps.archive.outputs.tgz }} > release_notes.txt | ||
- name: Generate changelog | ||
.github/workflows/release_prep.sh v${{ inputs.version }} > release_notes.txt | ||
printf '${{ steps.extract-changelog.outputs.markdown }}' >> release_notes.txt | ||
- name: Create draft release | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
printf '\n-----\n\n' >> release_notes.txt | ||
awk -f .github/workflows/changelog.awk CHANGELOG.md >> release_notes.txt | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
draft: true | ||
body_path: release_notes.txt | ||
fail_on_unmatched_files: true | ||
files: ${{ steps.archive.outputs.tgz }} | ||
gh release create \ | ||
--draft \ | ||
--notes-file release_notes.txt \ | ||
--title v${{ inputs.version }} \ | ||
v${{ inputs.version }} \ | ||
${GITHUB_REPOSITORY#*/}-${{ inputs.version }}.tar.gz | tee release_url | ||
- name: Write summary | ||
run: 'echo ":rocket: Draft release created [here]($( cat release_url ))" >> "${GITHUB_STEP_SUMMARY}"' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Publish | |
|
||
on: | ||
release: | ||
types: [published] | ||
types: [released] | ||
workflow_dispatch: # allows manual triggering | ||
|
||
jobs: | ||
|
@@ -21,5 +21,30 @@ 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 | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
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 -i \ | ||
-e '/bazel_dep(name = "rules_haskell"/s/version = "[^"]*"/version = "${{ steps.latest.outputs.version }}"/' \ | ||
start | ||
# update http_archive attrs between `name = "rules_haskell"` and `url = "` | ||
sed -i \ | ||
-e '/name = "rules_haskell"/,/url = "/{' \ | ||
-e ' s%x\{64\}%${{ steps.latest.outputs.hash }}%; ' \ | ||
-e ' s%M[.]NN%${{ steps.latest.outputs.version }}%g ' \ | ||
-e '}' \ | ||
start docs/haskell-use-cases.rst | ||
- name: Commit and Push | ||
run: | | ||
if ! git diff --exit-code ; then | ||
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 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
TAG=$1 | ||
REPO_NAME=${GITHUB_REPOSITORY#*/} | ||
# The prefix is chosen to match what GitHub generates for source archives | ||
PREFIX="${REPO_NAME}-${TAG:1}" | ||
ARCHIVE="${REPO_NAME}-${TAG:1}.tar.gz" | ||
git archive --format=tar.gz --prefix="${PREFIX}/" -o $ARCHIVE HEAD | ||
SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}') | ||
|
||
cat << EOF | ||
## Using Bzlmod with Bazel 6+ | ||
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`. | ||
2. Add to your \`MODULE.bazel\` file: | ||
\`\`\`starlark | ||
bazel_dep(name = "${REPO_NAME}", version = "${TAG:1}") | ||
\`\`\` | ||
## Using WORKSPACE | ||
Paste this snippet into your \`WORKSPACE.bazel\` file: | ||
\`\`\`starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "${REPO_NAME}", | ||
sha256 = "${SHA}", | ||
strip_prefix = "$PREFIX", | ||
urls = ["https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/$ARCHIVE"], | ||
) | ||
load("@${REPO_NAME}//haskell:repositories.bzl", "${REPO_NAME}_dependencies") | ||
${REPO_NAME}_dependencies() | ||
\`\`\` | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module( | ||
name = "rules_haskell", | ||
version = "0.19", | ||
version = "1.0", | ||
) | ||
|
||
bazel_dep( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"homepage": "", | ||
"maintainers": [], | ||
"versions": ["0.19"], | ||
"versions": ["1.0"], | ||
"yanked_versions": [] | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"homepage": "", | ||
"maintainers": [], | ||
"versions": ["0.19"], | ||
"versions": ["1.0"], | ||
"yanked_versions": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.