-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roll out workflow for automatic release notes and deployment. Include…
… pull request template and labels. (#27)
- Loading branch information
1 parent
fff3399
commit 37fb65e
Showing
11 changed files
with
297 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
### This PR is related to user story DST- | ||
|
||
## Description | ||
Provide a short description about the work that has been done. | ||
|
||
## Checklist | ||
- [ ] PR title is descriptive and fit for injection into release notes (see tips below) | ||
- [ ] Correct label(s) are used | ||
|
||
|
||
PR title tips: | ||
* Use imperative mood | ||
* Describe the motivation for change, issue that has been solved or what has been improved - not how | ||
* Examples: | ||
* Add functionality for Allan variance to sensor_4s.simulate | ||
* Upgrade to support Python 9.10 | ||
* Remove MacOS from CI | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
changelog: | ||
exclude: | ||
labels: | ||
- chore | ||
- test | ||
|
||
categories: | ||
- title: Breaking Changes 🛠 | ||
labels: | ||
- breaking-change | ||
- title: Features 🎉 | ||
labels: | ||
- feature | ||
- enhancement | ||
- title: Bug Fixes 🐛 | ||
labels: | ||
- bug | ||
- title: Other Changes ✅ | ||
labels: | ||
- documentation | ||
- refactor | ||
- "*" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
name: Deploy Public | ||
|
||
env: | ||
REPO_NAME: fourinsight-campaigns-python | ||
REPO_NAME_SHORT: campaigns | ||
SRC_ROOT_PATH: "./fourinsight/campaigns" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_number: | ||
description: Release version number [MAJOR.MINOR.PATCH] to deploy. Use "$latest" to automatically choose the latest release. | ||
required: true | ||
type: string | ||
default: "$latest" | ||
pipeline: | ||
description: Choose deploy pipeline. | ||
required: true | ||
default: production | ||
type: choice | ||
options: | ||
- production | ||
- test | ||
doc_latest: | ||
description: Deploy documentation as latest? | ||
default: true | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version_number: ${{ steps.version_number.outputs.VERSION_NUMBER }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install build sphinx==5.3.0 pydata_sphinx_theme==0.11.0 | ||
- name: Get new version number from input | ||
id: version_number | ||
run: | | ||
if [ "${{ inputs.version_number }}" = "$latest" ] | ||
then | ||
version="$(gh release view --json tagName --jq .tagName)" | ||
version=${version#v} | ||
else | ||
version="${{ inputs.version_number }}" | ||
fi | ||
echo "VERSION_NUMBER=$version" | tee $GITHUB_ENV $GITHUB_OUTPUT | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Replace package version number | ||
run: | | ||
filename="$SRC_ROOT_PATH/__init__.py" | ||
search_pattern="__version__ = \"0.0.1\"" | ||
replacement_text="__version__ = \"$VERSION_NUMBER\"" | ||
sed -i "s/$search_pattern/$replacement_text/" "$filename" | ||
- name : Inject release notes to documentation | ||
run: | | ||
echo $VERSION_NUMBER | ||
n_tag=25 | ||
i=0 | ||
|
||
# Note: may have to use paging if the number of releases gets very high | ||
for tag in $(gh api "/repos/{owner}/{repo}/releases" --paginate -q .[].tag_name) | ||
do | ||
if [[ "$tag" == "v$VERSION_NUMBER" ]]; | ||
then | ||
inject=True | ||
fi | ||
if [[ "$inject" == "True" ]] && [[ $i -le $n_tag ]]; | ||
then | ||
i=$((i+1)) | ||
echo -e "$(gh release view $tag --json name --template '{{.name}}\n------------------------------')" >> docs/release_notes.rst | ||
echo -e "$(gh release view $tag --json body --template '{{.body}}\n')" | sed 's/<!-[^~]*->//g' | sed G >> docs/release_notes.rst | ||
fi | ||
done | ||
echo -e "*Note: this list includes only the most recent releases. For full release history, see www.github.com/$REPO_NAME/releases" >> docs/release_notes.rst | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
- name: Build package | ||
run: python -m build --sdist --wheel --outdir ./dist | ||
|
||
- name: Build documentation | ||
run: | | ||
pip install . | ||
sphinx-build -b html ./docs ./build/html | ||
- name: Stash build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build_artifacts | ||
path: | | ||
./dist/*.whl | ||
./build/html | ||
retention-days: 1 | ||
|
||
deploy-test: | ||
if: ${{ inputs.pipeline == 'test' }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
env: | ||
VERSION_NUMBER: ${{ needs.build.outputs.version_number }} | ||
|
||
steps: | ||
- name: Clean up artifacts directory | ||
shell: pwsh | ||
run: Get-ChildItem . | Remove-Item -Recurse -Force | ||
|
||
- name: Fetch build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build_artifacts | ||
|
||
- name: Publish package to TestPyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TEST_API_KEY }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- name: Upload documentation to TEST blob storage | ||
uses: azure/CLI@v1 | ||
env: | ||
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.FOURINSIGHTTEST_DOC_BLOB_CONNSTR }} | ||
with: | ||
inlineScript: | | ||
az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/$VERSION_NUMBER" | ||
- name: Upload documentation to TEST blob storage as latest | ||
if: ${{ inputs.doc_latest }} | ||
uses: azure/CLI@v1 | ||
env: | ||
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.FOURINSIGHTTEST_DOC_BLOB_CONNSTR }} | ||
with: | ||
inlineScript: | | ||
az storage blob delete-batch -s "\$web" --pattern "$REPO_NAME_SHORT/python/docs/latest/*" | ||
az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/latest" | ||
deploy-prod: | ||
if: ${{ inputs.pipeline == 'production' }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
env: | ||
VERSION_NUMBER: ${{ needs.build.outputs.version_number }} | ||
|
||
steps: | ||
- name: Clean up artifacts directory | ||
shell: pwsh | ||
run: Get-ChildItem . | Remove-Item -Recurse -Force | ||
|
||
- name: Fetch build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build_artifacts | ||
|
||
- name: Publish package to PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_PROD_API_KEY }} | ||
|
||
- name: Upload documentation to PROD blob storage | ||
uses: azure/CLI@v1 | ||
env: | ||
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.FOURINSIGHTPROD_DOC_BLOB_CONNSTR }} | ||
with: | ||
inlineScript: | | ||
az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/$VERSION_NUMBER" | ||
- name: Upload documentation to PROD blob storage as latest | ||
if: ${{ inputs.doc_latest }} | ||
uses: azure/CLI@v1 | ||
env: | ||
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.FOURINSIGHTPROD_DOC_BLOB_CONNSTR }} | ||
with: | ||
inlineScript: | | ||
az storage blob delete-batch -s "\$web" --pattern "$REPO_NAME_SHORT/python/docs/latest/*" | ||
az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Make Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_number: | ||
description: Version number [MAJOR.MINOR.PATCH] | ||
required: true | ||
type: string | ||
|
||
env: | ||
VERSION_NUMBER: v${{ inputs.version_number }} | ||
|
||
jobs: | ||
make_release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Make release and generate notes | ||
run: | | ||
gh release create $VERSION_NUMBER --title "$VERSION_NUMBER ($(date +'%d %B %Y'))" --generate-notes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
|
||
.. autoclass:: {{ objname }} | ||
:members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.