build and release openstackquery package #6
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
name: build and release openstackquery package | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to release - make sure its same as setup.py' | |
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'] | |
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: 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 | |
uses: EndBug/latest-tag@latest | |
with: | |
tag-name: 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 }} |