Skip to content

Commit 16af08c

Browse files
authored
Merge pull request #127 from DMTF/Release-Workflow-Updates
Updated release process to be entirely driven by GitHub actions
2 parents 1255b4f + cd335af commit 16af08c

File tree

3 files changed

+76
-50
lines changed

3 files changed

+76
-50
lines changed

.github/workflows/main.yml

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,42 @@
11
name: Release and Publish
22
on:
3-
release:
4-
types: [published]
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Version number'
7+
required: true
8+
changes_1:
9+
description: 'Change entry'
10+
required: true
11+
changes_2:
12+
description: 'Change entry'
13+
required: false
14+
changes_3:
15+
description: 'Change entry'
16+
required: false
17+
changes_4:
18+
description: 'Change entry'
19+
required: false
20+
changes_5:
21+
description: 'Change entry'
22+
required: false
23+
changes_6:
24+
description: 'Change entry'
25+
required: false
26+
changes_7:
27+
description: 'Change entry'
28+
required: false
29+
changes_8:
30+
description: 'Change entry'
31+
required: false
532
jobs:
6-
push_to_registry:
7-
name: Push package to pypi
33+
release_build:
34+
name: Build the release
835
runs-on: ubuntu-latest
936
steps:
1037
- uses: actions/checkout@v2
38+
with:
39+
token: ${{secrets.GITHUB_TOKEN}}
1140
- name: Set up Python
1241
uses: actions/setup-python@v2
1342
with:
@@ -16,7 +45,44 @@ jobs:
1645
run: |
1746
python -m pip install --upgrade pip
1847
pip install setuptools wheel twine
19-
- name: Build and publish
48+
- name: Build the changelog text
49+
run: |
50+
echo 'CHANGES<<EOF' >> $GITHUB_ENV
51+
echo "## [${{github.event.inputs.version}}] - $(date +'%Y-%m-%d')" >> $GITHUB_ENV
52+
echo "- ${{github.event.inputs.changes_1}}" >> $GITHUB_ENV
53+
if [[ -n "${{github.event.inputs.changes_2}}" ]]; then echo "- ${{github.event.inputs.changes_2}}" >> $GITHUB_ENV; fi
54+
if [[ -n "${{github.event.inputs.changes_3}}" ]]; then echo "- ${{github.event.inputs.changes_3}}" >> $GITHUB_ENV; fi
55+
if [[ -n "${{github.event.inputs.changes_4}}" ]]; then echo "- ${{github.event.inputs.changes_4}}" >> $GITHUB_ENV; fi
56+
if [[ -n "${{github.event.inputs.changes_5}}" ]]; then echo "- ${{github.event.inputs.changes_5}}" >> $GITHUB_ENV; fi
57+
if [[ -n "${{github.event.inputs.changes_6}}" ]]; then echo "- ${{github.event.inputs.changes_6}}" >> $GITHUB_ENV; fi
58+
if [[ -n "${{github.event.inputs.changes_7}}" ]]; then echo "- ${{github.event.inputs.changes_7}}" >> $GITHUB_ENV; fi
59+
if [[ -n "${{github.event.inputs.changes_8}}" ]]; then echo "- ${{github.event.inputs.changes_8}}" >> $GITHUB_ENV; fi
60+
echo 'EOF' >> $GITHUB_ENV
61+
- name: Update version numbers
62+
run: |
63+
sed -i -E 's/ version=.+,/ version='\'${{github.event.inputs.version}}\'',/' setup.py
64+
sed -i -E 's/__version__ = .+/__version__ = "'${{github.event.inputs.version}}'"/' src/redfish/__init__.py
65+
- name: Update the changelog
66+
run: |
67+
ex CHANGELOG.md <<eof
68+
3 insert
69+
$CHANGES
70+
.
71+
xit
72+
eof
73+
- name: Commit and push the updates
74+
run: |
75+
git config user.name "GitHub Release Workflow"
76+
git config user.email "<>"
77+
git add CHANGELOG.md setup.py src/redfish/__init__.py
78+
git commit -s -m "${{github.event.inputs.version}} versioning"
79+
git push origin master
80+
- name: Make the release
81+
env:
82+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
83+
run: |
84+
gh release create ${{github.event.inputs.version}} -t ${{github.event.inputs.version}} -n "Changes since last release:"$'\n\n'"$CHANGES"
85+
- name: Build and publish to pypi
2086
env:
2187
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2288
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

README.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,11 @@ Contributing
187187
Release Process
188188
---------------
189189

190-
Run the ``release.sh`` script to publish a new version.
191-
192-
.. code-block:: shell
193-
194-
sh release.sh <NewVersion>
195-
196-
Enter the release notes when prompted; an empty line signifies no more notes to add.
190+
1. Go to the "Actions" page
191+
2. Select the "Release and Publish" workflow
192+
3. Click "Run workflow"
193+
4. Fill out the form
194+
5. Click "Run workflow"
197195

198196
Copyright and License
199197
---------------------

release.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)