-
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.
update CI, setup code-cov, pylint and build packages
- Loading branch information
1 parent
fe8a511
commit 1a2bef8
Showing
4 changed files
with
95 additions
and
12 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,91 @@ | ||
name: build and release openstackquery package | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to release' | ||
required: true | ||
changelog: | ||
description: 'Release changelog description' | ||
required: false | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
if: github.ref == 'refs/heads/main' | ||
|
||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.x'] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Update version in setup.py | ||
run: | | ||
sed -i "s/version=.*,/version='${{ github.event.inputs.version }}',/" setup.py | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel build | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist-${{ matrix.python-version }} | ||
path: dist/ | ||
|
||
publish: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: dist | ||
|
||
- name: Generate Changelog | ||
id: changelog | ||
run: | | ||
if [ -z "${{ github.event.inputs.changelog }}" ]; then | ||
echo "changelog=Release version ${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | ||
else | ||
echo "changelog=${{ github.event.inputs.changelog }}" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Create Git Tag | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git add version.txt | ||
git commit -m "Bump version to ${{ github.event.inputs.version }}" | ||
git tag v${{ github.event.inputs.version }} | ||
git push origin main | ||
git push origin v${{ github.event.inputs.version }} | ||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: v${{ github.event.inputs.version }} | ||
body: ${{ steps.changelog.outputs.changelog }} | ||
files: | | ||
dist/**/*.whl | ||
dist/**/*.tar.gz | ||
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
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
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