setup better python package builds for iriscasttools #193
This file contains hidden or 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: Cloud Energy Collection Tests | ||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "iriscasttools/**" | ||
| - ".github/workflows/iriscast_package_build.yaml" | ||
| pull_request: | ||
| paths: | ||
| - "iriscasttools/**" | ||
| - ".github/workflows/iriscast_package_build.yaml" | ||
| jobs: | ||
| test_and_lint: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.x", "3.10"] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Navigate to Folder | ||
| run: cd ./iriscasttools | ||
| - 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@v4 | ||
| 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@v4 | ||
| 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 }} | ||