From 514e48eced287dfc540552dcc773e564b8704fd9 Mon Sep 17 00:00:00 2001 From: Mike Raineri Date: Thu, 6 Apr 2023 09:36:13 -0400 Subject: [PATCH] Updated release process to use actions Signed-off-by: Mike Raineri --- .github/workflows/release.yml | 85 +++++++++++++++++++++++++++++++++++ README.md | 14 +++--- release.sh | 37 --------------- 3 files changed, 91 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100755 release.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..600e2b6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: Release and Publish +on: + workflow_dispatch: + inputs: + version: + description: 'Version number' + required: true + changes_1: + description: 'Change entry' + required: true + changes_2: + description: 'Change entry' + required: false + changes_3: + description: 'Change entry' + required: false + changes_4: + description: 'Change entry' + required: false + changes_5: + description: 'Change entry' + required: false + changes_6: + description: 'Change entry' + required: false + changes_7: + description: 'Change entry' + required: false + changes_8: + description: 'Change entry' + required: false +jobs: + release_build: + name: Build the release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{secrets.GITHUB_TOKEN}} + - name: Build the changelog text + run: | + echo 'CHANGES<> $GITHUB_ENV + echo "## [${{github.event.inputs.version}}] - $(date +'%Y-%m-%d')" >> $GITHUB_ENV + echo "- ${{github.event.inputs.changes_1}}" >> $GITHUB_ENV + if [[ -n "${{github.event.inputs.changes_2}}" ]]; then echo "- ${{github.event.inputs.changes_2}}" >> $GITHUB_ENV; fi + if [[ -n "${{github.event.inputs.changes_3}}" ]]; then echo "- ${{github.event.inputs.changes_3}}" >> $GITHUB_ENV; fi + if [[ -n "${{github.event.inputs.changes_4}}" ]]; then echo "- ${{github.event.inputs.changes_4}}" >> $GITHUB_ENV; fi + if [[ -n "${{github.event.inputs.changes_5}}" ]]; then echo "- ${{github.event.inputs.changes_5}}" >> $GITHUB_ENV; fi + if [[ -n "${{github.event.inputs.changes_6}}" ]]; then echo "- ${{github.event.inputs.changes_6}}" >> $GITHUB_ENV; fi + if [[ -n "${{github.event.inputs.changes_7}}" ]]; then echo "- ${{github.event.inputs.changes_7}}" >> $GITHUB_ENV; fi + if [[ -n "${{github.event.inputs.changes_8}}" ]]; then echo "- ${{github.event.inputs.changes_8}}" >> $GITHUB_ENV; fi + echo "" >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + - name: Update version numbers + run: | + sed -i -E 's/Version:\t.+/Version:\t'${{github.event.inputs.version}}'/' rpm/libredfish.spec + - name: Update the changelog + run: | + ex CHANGELOG.md <" + git add CHANGELOG.md rpm/libredfish.spec + git commit -s -m "${{github.event.inputs.version}} versioning" + git push origin main + - name: Make the release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + tag_name: ${{github.event.inputs.version}} + release_name: ${{github.event.inputs.version}} + body: | + Changes since last release: + + ${{env.CHANGES}} + draft: false + prerelease: false diff --git a/README.md b/README.md index 6ff63eb..60fd489 100644 --- a/README.md +++ b/README.md @@ -105,12 +105,10 @@ int main(int argc, char** argv) } ``` -# Release Process +## Release Process -Run the `release.sh` script to publish a new version. - -```bash -sh release.sh -``` - -Enter the release notes when prompted; an empty line signifies no more notes to add. +1. Go to the "Actions" page +2. Select the "Release and Publish" workflow +3. Click "Run workflow" +4. Fill out the form +5. Click "Run workflow" diff --git a/release.sh b/release.sh deleted file mode 100755 index 68adc7e..0000000 --- a/release.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Collect change log info -CHANGES="## [$1] - $(date +'%Y-%m-%d')"$'\n' -echo "Enter changes:" -while : ; do - read CHANGE - if [ "$CHANGE" = "" ]; then - break - fi - - CHANGES="$CHANGES- $CHANGE"$'\n' -done - -# Rebase -git checkout main -git fetch && git rebase origin - -# Update the version number in rf_protocol_validator.py -sed -i -E 's/Version:\t.+/Version:\t'$1'/' rpm/libredfish.spec - -# Update the change log file -ex CHANGELOG.md <