Skip to content

Commit

Permalink
New process to release new versions via actions
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Raineri <michael.raineri@dell.com>
  • Loading branch information
mraineri committed Jun 20, 2022
1 parent 9c71d84 commit 3878d41
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 8 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,102 @@
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<<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 "" >> $GITHUB_ENV
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/ self\.version=".+"/ self.version="'${{github.event.inputs.version}}'"/' redfishtoollib/redfishtoolTransport.py
sed -i -E 's/ self\.releaseDate=".+"/ self.releaseDate="'$(date +'%m\/%d\/%Y')'"/' redfishtoollib/redfishtoolTransport.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 redfishtoollib/redfishtoolTransport.py
git commit -s -m "${{github.event.inputs.version}} versioning"
git push origin master
- 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
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish to pypi
env:
TWINE_USERNAME: ${{secrets.PYPI_USERNAME}}
TWINE_PASSWORD: ${{secrets.PYPI_PASSWORD}}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
13 changes: 5 additions & 8 deletions README.md
Expand Up @@ -600,11 +600,8 @@ In order for executables to resolve if using Windows, ensure both the "Python" a

## Release Process

1. Update `CHANGELOG.md` with the list of changes since the last release
2. Update the `self.version` and `self.releaseDate` variables in `redfishtool/redfishtoolTransport.py` to reflect the new tool version
3. Update setup.py to reflect the new tool version
4. Push changes to Github
5. Create a new release in Github
6. Push the new tool version to pypi.org
* `python setup.py sdist`
* `twine upload dist/*`
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"

0 comments on commit 3878d41

Please sign in to comment.