forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Release build automation ([ElementsProject#7776]).
Changelog-None
- Loading branch information
Showing
3 changed files
with
144 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
# https://docs.corelightning.org/docs/release-checklist | ||
name: "Release 🚀" | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+[0-9a-z]+' | ||
workflow_dispatch: | ||
inputs: | ||
release_tag: | ||
description: Tag to release | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
outputs: | ||
version: steps.capture.outputs.version | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
|
||
- name: Determine version from pushed tag | ||
if: ${{ github.ref_type == 'tag' }} | ||
run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV" | ||
|
||
# Relevant for testing branches. | ||
- name: Determine version from pushed branch tag | ||
if: ${{ github.ref_type == 'branch' }} | ||
run: echo "VERSION=$(git tag --points-at HEAD)" >> "$GITHUB_ENV" | ||
|
||
- name: Determine version from dispatched workflow | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: echo "VERSION=${{ inputs.release_tag }}" >> "$GITHUB_ENV" | ||
|
||
- name: Validate release | ||
run: tools/check-release.sh --version=${VERSION} | ||
|
||
- name: Catpure version output | ||
id: capture | ||
run: echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
|
||
release: | ||
name: Release | ||
needs: check | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
|
||
# tools/build-release.sh requires lowdown | ||
- name: Prepare base environment | ||
run: | | ||
sudo apt-get install -y lowdown | ||
./configure | ||
- name: Build environment setup | ||
run: contrib/cl-repro.sh | ||
|
||
- name: Build release | ||
run: tools/build-release.sh bin-Fedora-28-amd64 bin-Ubuntu | ||
|
||
- name: Upload release artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: release/ | ||
if-no-files-found: error |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#! /bin/bash | ||
|
||
set -e | ||
|
||
# Git release tag checks and validation, to catch common release | ||
# tagging issues prior to build via Github Actions. | ||
# | ||
# 1. The tag should point to the HEAD of the branch. | ||
# - tools/build-release.sh#67 | ||
# 2. The pushed tag should match the branch tag at the HEAD. | ||
# 3. The CHANGELOG.md contains a header entry for the version tag. | ||
# 4. The CHANGELOG.md entry for that version tag can be parsed for a date. | ||
|
||
for arg; do | ||
case "$arg" in | ||
--version=*) | ||
VERSION=${arg#*=} | ||
;; | ||
--help) | ||
echo "Usage: [--version=<ver>]" | ||
exit 0 | ||
;; | ||
*) | ||
echo "Unknown arg $arg" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
echo "VERSION: ${VERSION}" | ||
|
||
# The tag should point to the HEAD of the branch. | ||
HEAD_VERSION=$(git tag --points-at HEAD) | ||
if [ "$HEAD_VERSION" = "" ]; then | ||
echo "No tagged version at HEAD?" >&2 | ||
exit 1 | ||
fi | ||
|
||
# The pushed tag should match the branch tag at the HEAD. | ||
if [ "$HEAD_VERSION" != "$VERSION" ]; then | ||
echo "The HEAD tag must match the version tag." >&2 | ||
exit 1 | ||
fi | ||
|
||
# The pushed tag should match the `make version` target output. | ||
MAKE_VERSION=$(make version) | ||
echo "MAKE_VERSION=$MAKE_VERSION" | ||
if [ "$MAKE_VERSION" != "$VERSION" ]; then | ||
echo "The version tag must match the \`make version\` target output." >&2 | ||
exit 1 | ||
fi | ||
|
||
# The CHANGELOG.md contains a header entry for the version tag. | ||
CHANGELOG_TITLE=$(grep "## \[${VERSION#v}\]" CHANGELOG.md) | ||
if [ "$CHANGELOG_TITLE" = "" ]; then | ||
echo "No entry in the CHANGELOG.md found for $VERSION." >&2 | ||
exit 1 | ||
fi | ||
echo "CHANGELOG_TITLE=$CHANGELOG_TITLE" | ||
|
||
# The CHANGELOG.md entry for that version tag can be parsed for a date. | ||
RELEASE_DATE=$(sed -n "s/^## \\[.*${VERSION#v}\\] - \\([-0-9]*\\).*/\\1/p" < CHANGELOG.md) | ||
echo "RELEASE_DATE=$RELEASE_DATE" | ||
if [ "$RELEASE_DATE" = "" ]; then | ||
echo "The release title in CHANGELOG.md cannot be parsed for a date." >&2 | ||
exit 1 | ||
fi |