mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
feat: Create releases in CI (#2168)
Fix: https://github.com/XRPLF/clio/issues/1779
This commit is contained in:
24
.github/scripts/prepare-release-artifacts.sh
vendored
Executable file
24
.github/scripts/prepare-release-artifacts.sh
vendored
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex -o pipefail
|
||||||
|
|
||||||
|
BINARY_NAME="clio_server"
|
||||||
|
|
||||||
|
ARTIFACTS_DIR="$1"
|
||||||
|
if [ -z "${ARTIFACTS_DIR}" ]; then
|
||||||
|
echo "Usage: $0 <artifacts_directory>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${ARTIFACTS_DIR}" || exit 1
|
||||||
|
|
||||||
|
for artifact_name in $(ls); do
|
||||||
|
pushd "${artifact_name}" || exit 1
|
||||||
|
zip -r "../${artifact_name}.zip" ./${BINARY_NAME}
|
||||||
|
popd || exit 1
|
||||||
|
|
||||||
|
rm "${artifact_name}/${BINARY_NAME}"
|
||||||
|
rm -r "${artifact_name}"
|
||||||
|
|
||||||
|
sha256sum "./${artifact_name}.zip" > "./${artifact_name}.zip.sha256sum"
|
||||||
|
done
|
||||||
10
.github/workflows/nightly.yml
vendored
10
.github/workflows/nightly.yml
vendored
@@ -16,6 +16,7 @@ on:
|
|||||||
|
|
||||||
- ".github/actions/**"
|
- ".github/actions/**"
|
||||||
- "!.github/actions/code_coverage/**"
|
- "!.github/actions/code_coverage/**"
|
||||||
|
- .github/scripts/prepare-release-artifacts.sh
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
|
# Only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
|
||||||
@@ -96,7 +97,14 @@ jobs:
|
|||||||
overwrite_release: true
|
overwrite_release: true
|
||||||
title: "Clio development (nightly) build"
|
title: "Clio development (nightly) build"
|
||||||
version: nightly
|
version: nightly
|
||||||
notes_header_file: nightly_notes.md
|
header: >
|
||||||
|
# Release notes
|
||||||
|
|
||||||
|
> **Note:** Please remember that this is a development release and it is not recommended for production use.
|
||||||
|
|
||||||
|
Changelog (including previous releases): <https://github.com/XRPLF/clio/commits/nightly>
|
||||||
|
generate_changelog: false
|
||||||
|
draft: false
|
||||||
|
|
||||||
build_and_publish_docker_image:
|
build_and_publish_docker_image:
|
||||||
uses: ./.github/workflows/build_clio_docker_image.yml
|
uses: ./.github/workflows/build_clio_docker_image.yml
|
||||||
|
|||||||
7
.github/workflows/nightly_notes.md
vendored
7
.github/workflows/nightly_notes.md
vendored
@@ -1,7 +0,0 @@
|
|||||||
# Release notes
|
|
||||||
|
|
||||||
> **Note:** Please remember that this is a development release and it is not recommended for production use.
|
|
||||||
|
|
||||||
Changelog (including previous releases): <https://github.com/XRPLF/clio/commits/nightly>
|
|
||||||
|
|
||||||
## SHA256 checksums
|
|
||||||
56
.github/workflows/release.yml
vendored
Normal file
56
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: Create release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*.*.*"
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/release.yml
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# Only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
name: Build and Test
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: macos15
|
||||||
|
conan_profile: default_apple_clang
|
||||||
|
build_type: Release
|
||||||
|
static: false
|
||||||
|
- os: heavy
|
||||||
|
conan_profile: gcc
|
||||||
|
build_type: Release
|
||||||
|
static: true
|
||||||
|
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||||
|
|
||||||
|
uses: ./.github/workflows/build_and_test.yml
|
||||||
|
with:
|
||||||
|
runs_on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
conan_profile: ${{ matrix.conan_profile }}
|
||||||
|
build_type: ${{ matrix.build_type }}
|
||||||
|
static: ${{ matrix.static }}
|
||||||
|
run_unit_tests: true
|
||||||
|
run_integration_tests: true
|
||||||
|
upload_clio_server: true
|
||||||
|
disable_cache: true
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: build-and-test
|
||||||
|
uses: ./.github/workflows/release_impl.yml
|
||||||
|
with:
|
||||||
|
overwrite_release: false
|
||||||
|
title: "${{ github.ref_name}}"
|
||||||
|
version: "${{ github.ref_name }}"
|
||||||
|
header: >
|
||||||
|
# Introducing Clio version ${{ github.ref_name }}
|
||||||
|
generate_changelog: true
|
||||||
|
draft: true
|
||||||
71
.github/workflows/release_impl.yml
vendored
71
.github/workflows/release_impl.yml
vendored
@@ -18,14 +18,26 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
notes_header_file:
|
header:
|
||||||
description: "Release notes header file"
|
description: "Release notes header"
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
generate_changelog:
|
||||||
|
description: "Generate changelog"
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
draft:
|
||||||
|
description: "Create a draft release"
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: heavy
|
||||||
|
container:
|
||||||
|
image: ghcr.io/xrplf/clio-ci:latest
|
||||||
env:
|
env:
|
||||||
GH_REPO: ${{ github.repository }}
|
GH_REPO: ${{ github.repository }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
@@ -35,29 +47,55 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Prepare runner
|
||||||
|
uses: ./.github/actions/prepare_runner
|
||||||
|
with:
|
||||||
|
disable_ccache: true
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: release_artifacts
|
path: release_artifacts
|
||||||
pattern: clio_server_*
|
pattern: clio_server_*
|
||||||
|
|
||||||
- name: Prepare files
|
- name: Create release notes
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
printf '%s\n' "${{ inputs.header }}" > "${RUNNER_TEMP}/release_notes.md"
|
||||||
|
|
||||||
|
- name: Generate changelog
|
||||||
|
shell: bash
|
||||||
|
if: ${{ inputs.generate_changelog }}
|
||||||
|
run: |
|
||||||
|
LAST_TAG=$(gh release view --json tagName -q .tagName)
|
||||||
|
LAST_TAG_COMMIT=$(git rev-parse $LAST_TAG)
|
||||||
|
BASE_COMMIT=$(git merge-base HEAD $LAST_TAG_COMMIT)
|
||||||
|
git-cliff "${BASE_COMMIT}..HEAD" --ignore-tags "nightly|-b"
|
||||||
|
cat CHANGELOG.md >> "${RUNNER_TEMP}/release_notes.md"
|
||||||
|
|
||||||
|
- name: Prepare release artifacts
|
||||||
|
shell: bash
|
||||||
|
run: .github/scripts/prepare-release-artifacts.sh release_artifacts
|
||||||
|
|
||||||
|
- name: Append sha256 checksums
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: release_artifacts
|
working-directory: release_artifacts
|
||||||
run: |
|
run: |
|
||||||
cp ${{ github.workspace }}/.github/workflows/${{ inputs.notes_header_file }} "${RUNNER_TEMP}/release_notes.md"
|
{
|
||||||
echo '' >> "${RUNNER_TEMP}/release_notes.md"
|
echo '## SHA256 checksums'
|
||||||
echo '```' >> "${RUNNER_TEMP}/release_notes.md"
|
echo
|
||||||
|
echo '```'
|
||||||
|
cat *.sha256sum
|
||||||
|
echo '```'
|
||||||
|
} >> "${RUNNER_TEMP}/release_notes.md"
|
||||||
|
|
||||||
for d in $(ls); do
|
- name: Upload release notes
|
||||||
archive_name=$(ls $d)
|
uses: actions/upload-artifact@v4
|
||||||
mv ${d}/${archive_name} ./
|
with:
|
||||||
rm -r $d
|
name: release_notes_${{ inputs.version }}
|
||||||
sha256sum ./$archive_name > ./${archive_name}.sha256sum
|
path: "${RUNNER_TEMP}/release_notes.md"
|
||||||
cat ./$archive_name.sha256sum >> "${RUNNER_TEMP}/release_notes.md"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo '```' >> "${RUNNER_TEMP}/release_notes.md"
|
|
||||||
|
|
||||||
- name: Remove current release and tag
|
- name: Remove current release and tag
|
||||||
if: ${{ github.event_name != 'pull_request' && inputs.overwrite_release }}
|
if: ${{ github.event_name != 'pull_request' && inputs.overwrite_release }}
|
||||||
@@ -74,5 +112,6 @@ jobs:
|
|||||||
${{ inputs.overwrite_release && '--prerelease' || '' }} \
|
${{ inputs.overwrite_release && '--prerelease' || '' }} \
|
||||||
--title "${{ inputs.title }}" \
|
--title "${{ inputs.title }}" \
|
||||||
--target $GITHUB_SHA \
|
--target $GITHUB_SHA \
|
||||||
|
${{ inputs.draft && '--draft' || '' }} \
|
||||||
--notes-file "${RUNNER_TEMP}/release_notes.md" \
|
--notes-file "${RUNNER_TEMP}/release_notes.md" \
|
||||||
./release_artifacts/clio_server*
|
./release_artifacts/clio_server*
|
||||||
|
|||||||
17
cliff.toml
17
cliff.toml
@@ -8,15 +8,24 @@
|
|||||||
[changelog]
|
[changelog]
|
||||||
# template for the changelog header
|
# template for the changelog header
|
||||||
header = """
|
header = """
|
||||||
# Changelog\n
|
|
||||||
All notable changes to this project will be documented in this file.\n
|
|
||||||
"""
|
"""
|
||||||
# template for the changelog body
|
# template for the changelog body
|
||||||
# https://keats.github.io/tera/docs/#introduction
|
# https://keats.github.io/tera/docs/#introduction
|
||||||
|
|
||||||
body = """
|
body = """
|
||||||
{% if version %}\
|
{% if version %}\
|
||||||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
Version {{ version | trim_start_matches(pat="v") }} of Clio, an XRP Ledger API server optimized for HTTP and WebSocket API calls, is now available.
|
||||||
{% else %}\
|
{% else %}\
|
||||||
|
Clio, an XRP Ledger API server optimized for HTTP and WebSocket API calls, is under active development.
|
||||||
|
{% endif %}\
|
||||||
|
|
||||||
|
<!-- Please, remove one of the 2 following lines -->
|
||||||
|
This release adds new features and bug fixes.
|
||||||
|
This release adds bug fixes.
|
||||||
|
\
|
||||||
|
{% if version %}
|
||||||
|
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||||
|
{% else %}
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
{% endif %}\
|
{% endif %}\
|
||||||
{% for group, commits in commits | filter(attribute="merge_commit", value=false) | group_by(attribute="group") %}
|
{% for group, commits in commits | filter(attribute="merge_commit", value=false) | group_by(attribute="group") %}
|
||||||
@@ -24,7 +33,7 @@ body = """
|
|||||||
{% for commit in commits %}
|
{% for commit in commits %}
|
||||||
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
||||||
{% if commit.breaking %}[**breaking**] {% endif %}\
|
{% if commit.breaking %}[**breaking**] {% endif %}\
|
||||||
{{ commit.message | upper_first }} {% if commit.remote.username %}by @{{ commit.remote.username }}{% endif %}\
|
{{ commit.message | upper_first }}{% if commit.remote.username %} by @{{ commit.remote.username }}{% endif %}\
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}\n
|
{% endfor %}\n
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user