mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 11:55:51 +00:00
feat: Introduce release_impl.yml workflow to automatically create rel… (#2043)
…eases Work on: https://github.com/XRPLF/clio/issues/1779 Features: - works in PRs (everything but actually pushing a release) - supports custom release notes header - removes previous release for nightly releases The idea is that creating releases should be automatic or almost automatic and should work more or less the same for nightly and actual releases. I haven't yet implemented automatic release process for the actual release (and don't plan to do it here), but this PR will make it much easier to implement it in the future. I suggest deferring discussion of how actual releases should work till the next PR.
This commit is contained in:
49
.github/workflows/nightly.yml
vendored
49
.github/workflows/nightly.yml
vendored
@@ -103,50 +103,13 @@ jobs:
|
||||
./clio_integration_tests --backend_host=scylladb
|
||||
|
||||
nightly_release:
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
needs: run_tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: nightly_release
|
||||
pattern: clio_server_*
|
||||
|
||||
- name: Prepare files
|
||||
shell: bash
|
||||
run: |
|
||||
cp ${{ github.workspace }}/.github/workflows/nightly_notes.md "${RUNNER_TEMP}/nightly_notes.md"
|
||||
cd nightly_release
|
||||
echo '' >> "${RUNNER_TEMP}/nightly_notes.md"
|
||||
echo '```' >> "${RUNNER_TEMP}/nightly_notes.md"
|
||||
for d in $(ls); do
|
||||
archive_name=$(ls $d)
|
||||
mv ${d}/${archive_name} ./
|
||||
rm -r $d
|
||||
sha256sum ./$archive_name > ./${archive_name}.sha256sum
|
||||
cat ./$archive_name.sha256sum >> "${RUNNER_TEMP}/nightly_notes.md"
|
||||
done
|
||||
echo '```' >> "${RUNNER_TEMP}/nightly_notes.md"
|
||||
|
||||
- name: Remove current nightly release and nightly tag
|
||||
shell: bash
|
||||
run: |
|
||||
gh release delete nightly --yes || true
|
||||
git push origin :nightly || true
|
||||
|
||||
- name: Publish nightly release
|
||||
shell: bash
|
||||
run: |
|
||||
gh release create nightly --prerelease --title "Clio development (nightly) build" \
|
||||
--target $GITHUB_SHA --notes-file "${RUNNER_TEMP}/nightly_notes.md" \
|
||||
./nightly_release/clio_server*
|
||||
uses: ./.github/workflows/release_impl.yml
|
||||
with:
|
||||
overwrite_release: true
|
||||
title: "Clio development (nightly) build"
|
||||
version: nightly
|
||||
notes_header_file: nightly_notes.md
|
||||
|
||||
build_and_publish_docker_image:
|
||||
uses: ./.github/workflows/build_clio_docker_image.yml
|
||||
|
||||
78
.github/workflows/release_impl.yml
vendored
Normal file
78
.github/workflows/release_impl.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
name: Make release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
overwrite_release:
|
||||
description: "Overwrite the current release and tag"
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
title:
|
||||
description: "Release title"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
version:
|
||||
description: "Release version"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
notes_header_file:
|
||||
description: "Release notes header file"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release_artifacts
|
||||
pattern: clio_server_*
|
||||
|
||||
- name: Prepare files
|
||||
shell: bash
|
||||
working-directory: release_artifacts
|
||||
run: |
|
||||
cp ${{ github.workspace }}/.github/workflows/${{ inputs.notes_header_file }} "${RUNNER_TEMP}/release_notes.md"
|
||||
echo '' >> "${RUNNER_TEMP}/release_notes.md"
|
||||
echo '```' >> "${RUNNER_TEMP}/release_notes.md"
|
||||
|
||||
for d in $(ls); do
|
||||
archive_name=$(ls $d)
|
||||
mv ${d}/${archive_name} ./
|
||||
rm -r $d
|
||||
sha256sum ./$archive_name > ./${archive_name}.sha256sum
|
||||
cat ./$archive_name.sha256sum >> "${RUNNER_TEMP}/release_notes.md"
|
||||
done
|
||||
|
||||
echo '```' >> "${RUNNER_TEMP}/release_notes.md"
|
||||
|
||||
- name: Remove current release and tag
|
||||
if: ${{ github.event_name != 'pull_request' && inputs.overwrite_release }}
|
||||
shell: bash
|
||||
run: |
|
||||
gh release delete ${{ inputs.version }} --yes || true
|
||||
git push origin :${{ inputs.version }} || true
|
||||
|
||||
- name: Publish release
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
shell: bash
|
||||
run: |
|
||||
gh release create ${{ inputs.version }} \
|
||||
${{ inputs.overwrite_release && '--prerelease' || '' }} \
|
||||
--title ${{ inputs.title }} \
|
||||
--target $GITHUB_SHA \
|
||||
--notes-file "${RUNNER_TEMP}/release_notes.md" \
|
||||
./release_artifacts/clio_server*
|
||||
Reference in New Issue
Block a user