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

Updated release process to be entirely driven by GitHub actions #127

Merged
merged 2 commits into from
May 12, 2022
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
76 changes: 71 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
name: Release and Publish
on:
release:
types: [published]
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:
push_to_registry:
name: Push package to pypi
release_build:
name: Build the release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{secrets.GITHUB_TOKEN}}
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -16,7 +45,44 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
- name: Build the changelog text
run: |
echo 'CHANGES<<EOF' >> $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 'EOF' >> $GITHUB_ENV
- name: Update version numbers
run: |
sed -i -E 's/ version=.+,/ version='\'${{github.event.inputs.version}}\'',/' setup.py
sed -i -E 's/__version__ = .+/__version__ = "'${{github.event.inputs.version}}'"/' src/redfish/__init__.py
- name: Update the changelog
run: |
ex CHANGELOG.md <<eof
3 insert
$CHANGES
.
xit
eof
- name: Commit and push the updates
run: |
git config user.name "GitHub Release Workflow"
git config user.email "<>"
git add CHANGELOG.md setup.py src/redfish/__init__.py
git commit -s -m "${{github.event.inputs.version}} versioning"
git push origin master
- name: Make the release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh release create ${{github.event.inputs.version}} -t ${{github.event.inputs.version}} -n "Changes since last release:"$'\n\n'"$CHANGES"
- name: Build and publish to pypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down
12 changes: 5 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,11 @@ Contributing
Release Process
---------------

Run the ``release.sh`` script to publish a new version.

.. code-block:: shell

sh release.sh <NewVersion>

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"

Copyright and License
---------------------
Expand Down
38 changes: 0 additions & 38 deletions release.sh

This file was deleted.