Add bearer-JWT authentication for machine ingestion and Keycloak even… #55
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
| # GitHub Actions workflow for building, testing, and releasing Delve on version bump | |
| # This workflow runs on both Windows and Ubuntu runners | |
| # It only creates a release if the version in delve/__init__.py changes on main | |
| name: Build, Test, and Release Delve | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-test-windows: | |
| name: Build and Test on Windows | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14.6' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run build script | |
| run: python bootstrap.py all | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | |
| - name: Prepare settings and urls | |
| run: | | |
| copy build\assemble\delve\example-settings.py build\assemble\delve\settings.py | |
| copy build\assemble\delve\example-urls.py build\assemble\delve\urls.py | |
| - name: Run test suite | |
| shell: cmd | |
| run: | | |
| cd build\assemble | |
| python manage.py test | |
| - name: Upload Windows Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-dist | |
| path: dist/DELVE_*.zip | |
| build-test-linux: | |
| name: Build and Test on Ubuntu | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.current_version.outputs.version }} | |
| version_changed: ${{ steps.version_changed.outputs.changed }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14.6' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run build script | |
| run: python bootstrap.py all | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | |
| - name: Prepare settings and urls | |
| run: | | |
| cp build/assemble/delve/example-settings.py build/assemble/delve/settings.py | |
| cp build/assemble/delve/example-urls.py build/assemble/delve/urls.py | |
| - name: Get current version | |
| id: current_version | |
| run: | | |
| VERSION=$(grep -Po '(?<=__version__ = ")([^"]+)' delve/__init__.py) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Get previous version | |
| id: previous_version | |
| run: | | |
| git fetch origin main --depth=2 | |
| PREV_VERSION=$(git show HEAD^:delve/__init__.py 2>/dev/null | grep -Po '(?<=__version__ = ")([^"]+)' || echo "") | |
| echo "version=$PREV_VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if release exists | |
| id: check_release | |
| run: | | |
| if gh release view "v${{ steps.current_version.outputs.version }}" > /dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set version_changed output based on release existence | |
| id: version_changed | |
| run: | | |
| if [ "${{ steps.check_release.outputs.exists }}" = "false" ] && [ "${{ steps.current_version.outputs.version }}" != "" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run test suite | |
| run: | | |
| cd build/assemble | |
| python manage.py test | |
| - name: Upload Linux Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-dist | |
| path: dist/DELVE_*.zip | |
| release: | |
| name: Create Release and Upload All Artifacts | |
| needs: [build-test-linux, build-test-windows] | |
| if: needs.build-test-linux.outputs.version_changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up GitHub CLI | |
| run: sudo apt-get install -y gh | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Check if release exists | |
| id: check_release | |
| run: | | |
| if gh release view "v${{ needs.build-test-linux.outputs.version }}" > /dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| if: steps.check_release.outputs.exists == 'false' | |
| run: | | |
| gh release create "v${{ needs.build-test-linux.outputs.version }}" --title "Delve ${{ needs.build-test-linux.outputs.version }}" --notes "" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Release Assets | |
| run: | | |
| for file in dist/**/*.zip; do | |
| gh release upload "v${{ needs.build-test-linux.outputs.version }}" "$file" --clobber | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Notes: | |
| # - The release and asset upload steps only run if the version number changed. | |
| # - Both Windows and Linux jobs will upload their artifacts to the same release. | |
| # - Make sure the dist/ directory contains the correct artifacts before these steps. | |
| # - The GITHUB_TOKEN secret is provided by GitHub Actions for authentication. |