Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Automation #7797

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
# 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]+'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's an example of what this last regex is looking to match?

it seems like it'd ignore things such as v0.1.3-beta. I believe the regex that you'd want for that would need to include the . and - in the options clause? Untested but...

v[0-9]+.[0-9]+[0-9a-z.-]+

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We literally append rcX, so "24.11rc3"...

workflow_dispatch:
create_release:
description: Create a draft release
default: no
type: choice
options:
- yes
- no

jobs:
check:
name: Check
outputs:
version: ${{ steps.capture.outputs.version }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this change should be back-ported to the prior commit, where the error was first introduced

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: Validate release
run: tools/check-release.sh --version=${VERSION}

- name: Catpure version output
id: capture
run: echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

releases:
name: Releases
needs: check
runs-on: ubuntu-24.04
strategy:
fail-fast: false # Let each build finish.
matrix:
target:
- 'bin-Fedora-28-amd64'
- 'bin-Ubuntu-focal'
- 'bin-Ubuntu-jammy'
- 'bin-Ubuntu-noble'
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: |
distribution=$(echo ${{ matrix.target }} | cut -d'-' -f3)
echo "Building base image for ${distribution}"
sudo docker run --rm -v $(pwd):/build ubuntu:${distribution} bash -c "\
apt-get update && \
apt-get install -y debootstrap && \
debootstrap ${distribution} /build/${distribution}"
sudo tar -C ${distribution} -c . | docker import - ${distribution}

# Build Docker image
docker build -t cl-repro-${distribution} - < contrib/reprobuild/Dockerfile.${distribution}
if: contains(matrix.target, 'Ubuntu')

- name: Build release
run: tools/build-release.sh ${{ matrix.target }}

- name: Upload target artifacts
uses: actions/upload-artifact@v4
with:
path: release/
name: ${{ matrix.target }}
if-no-files-found: error

artifact:
name: Construct release artifact
needs:
- check
- releases
env:
version: ${{ needs.check.outputs.version }}
runs-on: ubuntu-24.04
steps:
- name: Merge artifacts
uses: actions/upload-artifact/merge@v4
with:
name: c-lightning-${{ env.version }}
pattern: bin-*
delete-merged: true

release:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be called "sign_release"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see you update it next :)

name: Sign and prepare release draft
needs:
- check
- artifact
env:
version: ${{ needs.check.outputs.version }}
runs-on: ubuntu-24.04
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-tags: true

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: c-lightning-${{ env.version }}
path: release/

- name: Import GPG keys
id: gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
trust_level: 5

- name: Set default GPG key
run: echo "default-key ${{ steps.gpg.outputs.keyid }}" >> ~/.gnupg/gpg.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to not update the prior commit with this simplified method rather than editing it here?


- name: Sign release
run: |
sudo apt-get install -y lowdown
./configure
tools/build-release.sh --without-zip sign
mv release/SHA256SUMS.asc${{ steps.gpg.outputs.keyid }} release/SHA256SUMS.asc

- name: Upload signed artifact
uses: actions/upload-artifact@v4
with:
name: c-lightning-${{ env.version }}
overwrite: true
path: release/

- name: Determine release data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this should be in a separate commit from the previous changes in this file.

id: release_data
run: |
VERSION=${{ env.version }}
CHANGELOG_VERSION=${VERSION#v}
echo "CHANGELOG_VERSION=$CHANGELOG_VERSION"
echo "changelog_version=$CHANGELOG_VERSION" >> "$GITHUB_OUTPUT"

CHANGELOG_TITLE=$(grep "## \[${CHANGELOG_VERSION}\]" CHANGELOG.md)
echo "CHANGELOG_TITLE=$CHANGELOG_TITLE"
echo "changelog_title=$CHANGELOG_TITLE" >> "$GITHUB_OUTPUT"

RELEASE_TITLE=$(echo $CHANGELOG_TITLE | cut -d'"' -f2)
echo "RELEASE_TITLE=$RELEASE_TITLE"
echo "release_title=$RELEASE_TITLE" >> "$GITHUB_OUTPUT"

- name: Prepare release draft
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.create_release == 'yes')
uses: softprops/action-gh-release@v2
with:
name: "${{ env.version }} ${{ steps.release_data.outputs.release_title }}"
tag_name: ${{ env.version }}
draft: true
prerelease: contains(env.version, "-rc")
files: release/*
fail_on_unmatched_files: true
6 changes: 0 additions & 6 deletions action.yml

This file was deleted.

54 changes: 0 additions & 54 deletions contrib/docker/Dockerfile.alpine

This file was deleted.

69 changes: 0 additions & 69 deletions contrib/docker/Dockerfile.builder

This file was deleted.

78 changes: 0 additions & 78 deletions contrib/docker/Dockerfile.tester

This file was deleted.

Loading
Loading