Skip to content

Commit 3878d41

Browse files
committed
New process to release new versions via actions
Signed-off-by: Mike Raineri <[email protected]>
1 parent 9c71d84 commit 3878d41

File tree

2 files changed

+107
-8
lines changed

2 files changed

+107
-8
lines changed

.github/workflows/release.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Release and Publish
2+
on:
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
32+
jobs:
33+
release_build:
34+
name: Build the release
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
with:
39+
token: ${{secrets.GITHUB_TOKEN}}
40+
- name: Build the changelog text
41+
run: |
42+
echo 'CHANGES<<EOF' >> $GITHUB_ENV
43+
echo "## [${{github.event.inputs.version}}] - $(date +'%Y-%m-%d')" >> $GITHUB_ENV
44+
echo "- ${{github.event.inputs.changes_1}}" >> $GITHUB_ENV
45+
if [[ -n "${{github.event.inputs.changes_2}}" ]]; then echo "- ${{github.event.inputs.changes_2}}" >> $GITHUB_ENV; fi
46+
if [[ -n "${{github.event.inputs.changes_3}}" ]]; then echo "- ${{github.event.inputs.changes_3}}" >> $GITHUB_ENV; fi
47+
if [[ -n "${{github.event.inputs.changes_4}}" ]]; then echo "- ${{github.event.inputs.changes_4}}" >> $GITHUB_ENV; fi
48+
if [[ -n "${{github.event.inputs.changes_5}}" ]]; then echo "- ${{github.event.inputs.changes_5}}" >> $GITHUB_ENV; fi
49+
if [[ -n "${{github.event.inputs.changes_6}}" ]]; then echo "- ${{github.event.inputs.changes_6}}" >> $GITHUB_ENV; fi
50+
if [[ -n "${{github.event.inputs.changes_7}}" ]]; then echo "- ${{github.event.inputs.changes_7}}" >> $GITHUB_ENV; fi
51+
if [[ -n "${{github.event.inputs.changes_8}}" ]]; then echo "- ${{github.event.inputs.changes_8}}" >> $GITHUB_ENV; fi
52+
echo "" >> $GITHUB_ENV
53+
echo 'EOF' >> $GITHUB_ENV
54+
- name: Update version numbers
55+
run: |
56+
sed -i -E 's/ version=.+,/ version='\'${{github.event.inputs.version}}\'',/' setup.py
57+
sed -i -E 's/ self\.version=".+"/ self.version="'${{github.event.inputs.version}}'"/' redfishtoollib/redfishtoolTransport.py
58+
sed -i -E 's/ self\.releaseDate=".+"/ self.releaseDate="'$(date +'%m\/%d\/%Y')'"/' redfishtoollib/redfishtoolTransport.py
59+
- name: Update the changelog
60+
run: |
61+
ex CHANGELOG.md <<eof
62+
3 insert
63+
$CHANGES
64+
.
65+
xit
66+
eof
67+
- name: Commit and push the updates
68+
run: |
69+
git config user.name "GitHub Release Workflow"
70+
git config user.email "<>"
71+
git add CHANGELOG.md setup.py redfishtoollib/redfishtoolTransport.py
72+
git commit -s -m "${{github.event.inputs.version}} versioning"
73+
git push origin master
74+
- name: Make the release
75+
id: create_release
76+
uses: actions/create-release@v1
77+
env:
78+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
79+
with:
80+
tag_name: ${{github.event.inputs.version}}
81+
release_name: ${{github.event.inputs.version}}
82+
body: |
83+
Changes since last release:
84+
85+
${{env.CHANGES}}
86+
draft: false
87+
prerelease: false
88+
- name: Set up Python
89+
uses: actions/setup-python@v2
90+
with:
91+
python-version: '3.x'
92+
- name: Install dependencies
93+
run: |
94+
python -m pip install --upgrade pip
95+
pip install setuptools wheel twine
96+
- name: Build and publish to pypi
97+
env:
98+
TWINE_USERNAME: ${{secrets.PYPI_USERNAME}}
99+
TWINE_PASSWORD: ${{secrets.PYPI_PASSWORD}}
100+
run: |
101+
python setup.py sdist bdist_wheel
102+
twine upload dist/*

README.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,8 @@ In order for executables to resolve if using Windows, ensure both the "Python" a
600600

601601
## Release Process
602602

603-
1. Update `CHANGELOG.md` with the list of changes since the last release
604-
2. Update the `self.version` and `self.releaseDate` variables in `redfishtool/redfishtoolTransport.py` to reflect the new tool version
605-
3. Update setup.py to reflect the new tool version
606-
4. Push changes to Github
607-
5. Create a new release in Github
608-
6. Push the new tool version to pypi.org
609-
* `python setup.py sdist`
610-
* `twine upload dist/*`
603+
1. Go to the "Actions" page
604+
2. Select the "Release and Publish" workflow
605+
3. Click "Run workflow"
606+
4. Fill out the form
607+
5. Click "Run workflow"

0 commit comments

Comments
 (0)