mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
…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.
79 lines
2.2 KiB
YAML
79 lines
2.2 KiB
YAML
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*
|