|
| 1 | +name: Pre-Release Preswald |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - cicd |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + run_tests: |
| 10 | + description: "Run tests" |
| 11 | + required: true |
| 12 | + default: true |
| 13 | + type: boolean |
| 14 | + schedule: |
| 15 | + # Run weekly on Monday at 00:00 UTC |
| 16 | + - cron: "0 0 * * 1" |
| 17 | + |
| 18 | +jobs: |
| 19 | + pre-release: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@v4 |
| 27 | + with: |
| 28 | + python-version: "3.12" |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install build setuptools wheel twine |
| 34 | + pip install -e . |
| 35 | +
|
| 36 | + - name: Install bc for version calculations |
| 37 | + run: sudo apt-get install -y bc |
| 38 | + |
| 39 | + - name: Set up Google Cloud SDK |
| 40 | + uses: google-github-actions/setup-gcloud@v1 |
| 41 | + with: |
| 42 | + install_components: "gsutil" |
| 43 | + |
| 44 | + - name: Set up Docker Buildx |
| 45 | + uses: docker/setup-buildx-action@v3 |
| 46 | + |
| 47 | + - name: Login to DockerHub |
| 48 | + uses: docker/login-action@v2 |
| 49 | + with: |
| 50 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 51 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 52 | + |
| 53 | + - name: Set up Conda |
| 54 | + uses: conda-incubator/setup-miniconda@v3 |
| 55 | + with: |
| 56 | + auto-update-conda: true |
| 57 | + python-version: "3.12" |
| 58 | + |
| 59 | + - name: Run pre-release process |
| 60 | + run: | |
| 61 | + if [ "${{ inputs.run_tests }}" == "true" ]; then |
| 62 | + make pre-release |
| 63 | + else |
| 64 | + # Skip tests by running individual targets |
| 65 | + make update-version build-frontend build-wheel build-docker upload-to-gcs |
| 66 | + fi |
| 67 | + env: |
| 68 | + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} |
| 69 | + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
| 70 | + PRESWALD_DEPLOYER_DEV_SA: ${{ secrets.PRESWALD_DEPLOYER_DEV_SA }} |
| 71 | + |
| 72 | + - name: Upload wheel as artifact |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: preswald-wheel |
| 76 | + path: dist/*.whl |
| 77 | + if-no-files-found: error |
| 78 | + |
| 79 | + - name: Get version info |
| 80 | + id: get_version |
| 81 | + run: echo "VERSION=$(grep 'version' pyproject.toml | grep -v '^#' | head -1 | sed -E 's/.*version = "([^"]+)".*/\1/')" >> $GITHUB_OUTPUT |
| 82 | + |
| 83 | + - name: Summary |
| 84 | + run: | |
| 85 | + echo "## Pre-release Summary" >> $GITHUB_STEP_SUMMARY |
| 86 | + echo "- Version: ${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY |
| 87 | + echo "- Wheel: $(ls -t dist/preswald-*.whl | head -1)" >> $GITHUB_STEP_SUMMARY |
| 88 | + echo "- Docker Image: structuredlabs/preswald:latest" >> $GITHUB_STEP_SUMMARY |
0 commit comments