fix: harden torch version verification with explicit error handling #85
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: Docker Image Build and Release | |
| on: | |
| push: | |
| paths: | |
| - ".github/workflows/base.yml" | |
| - "official-templates/base/docker-bake.hcl" | |
| - "official-templates/base/Dockerfile" | |
| - "official-templates/pytorch/docker-bake.hcl" | |
| - "official-templates/pytorch/Dockerfile" | |
| - "official-templates/autoresearch/docker-bake.hcl" | |
| - "official-templates/autoresearch/Dockerfile" | |
| - "official-templates/shared/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-base: | |
| runs-on: blacksmith-8vcpu-ubuntu-2204 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Docker | |
| uses: ./.github/actions/docker-setup | |
| id: setup | |
| with: | |
| dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build base images | |
| uses: docker/bake-action@v6 | |
| env: | |
| BUILDX_BAKE_ENTITLEMENTS_FS: 0 | |
| RELEASE_SUFFIX: ${{ steps.setup.outputs.release-suffix }} | |
| with: | |
| source: . | |
| files: | | |
| official-templates/shared/versions.hcl | |
| official-templates/base/docker-bake.hcl | |
| push: true | |
| build-autoresearch: | |
| needs: build-base | |
| if: always() && (needs.build-base.result == 'success' || needs.build-base.result == 'skipped') | |
| runs-on: blacksmith-8vcpu-ubuntu-2204 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if build is needed | |
| uses: tj-actions/changed-files@v46 | |
| id: changes | |
| with: | |
| files_yaml: | | |
| autoresearch: | |
| - 'official-templates/shared/**' | |
| - 'official-templates/base/**' | |
| - 'official-templates/autoresearch/**' | |
| - name: Setup Docker | |
| if: steps.changes.outputs.autoresearch_any_changed == 'true' | |
| uses: ./.github/actions/docker-setup | |
| id: setup | |
| with: | |
| dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build autoresearch images | |
| if: steps.changes.outputs.autoresearch_any_changed == 'true' | |
| uses: docker/bake-action@v6 | |
| env: | |
| BUILDX_BAKE_ENTITLEMENTS_FS: 0 | |
| RELEASE_SUFFIX: ${{ steps.setup.outputs.release-suffix }} | |
| with: | |
| source: . | |
| files: | | |
| official-templates/shared/versions.hcl | |
| official-templates/autoresearch/docker-bake.hcl | |
| push: true | |
| build-pytorch: | |
| needs: build-base | |
| # always() forces job run even if the dependant is skipped (but not if it failed) | |
| if: always() && (needs.build-base.result == 'success' || needs.build-base.result == 'skipped') | |
| runs-on: blacksmith-16vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if build is needed | |
| uses: tj-actions/changed-files@v46 | |
| id: changes | |
| with: | |
| files_yaml: | | |
| pytorch: | |
| - 'official-templates/shared/**' | |
| - 'official-templates/pytorch/**' | |
| - name: Setup Docker | |
| if: github.event_name == 'workflow_dispatch' || steps.changes.outputs.pytorch_any_changed == 'true' | |
| uses: ./.github/actions/docker-setup | |
| id: setup | |
| with: | |
| dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build pytorch images | |
| if: github.event_name == 'workflow_dispatch' || steps.changes.outputs.pytorch_any_changed == 'true' | |
| uses: docker/bake-action@v6 | |
| env: | |
| BUILDX_BAKE_ENTITLEMENTS_FS: 0 | |
| RELEASE_SUFFIX: ${{ steps.setup.outputs.release-suffix }} | |
| with: | |
| source: . | |
| files: | | |
| official-templates/shared/versions.hcl | |
| official-templates/pytorch/docker-bake.hcl | |
| push: true |