diff --git a/.github/workflows/psc-cuda-devcontainer.yml b/.github/workflows/psc-cuda-devcontainer.yml index 1ebefe585..9f52355d3 100644 --- a/.github/workflows/psc-cuda-devcontainer.yml +++ b/.github/workflows/psc-cuda-devcontainer.yml @@ -5,6 +5,13 @@ on: branches: [ main, 'pr/*' ] pull_request: branches: [ main ] + workflow_dispatch: + inputs: + push_image: + description: Build and push the devcontainer image to GHCR + required: true + type: boolean + default: true permissions: contents: read @@ -13,6 +20,7 @@ permissions: jobs: build-cuda-devcontainer: runs-on: ubuntu-latest + if: github.event_name != 'workflow_dispatch' steps: - name: Checkout (github) @@ -35,3 +43,26 @@ jobs: runCmd: | cmake -S . -B build-cuda-ci -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPSC_GPU=cuda -DGTENSOR_DEVICE=cuda -G Ninja cmake --build build-cuda-ci + + push-cuda-devcontainer: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' && inputs.push_image + + steps: + - name: Checkout (github) + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push devcontainer image + uses: devcontainers/ci@v0.3 + with: + configFile: .devcontainer/devcontainer.json + imageName: ghcr.io/psc-code/psc-devcontainer + cacheFrom: ghcr.io/psc-code/psc-devcontainer + push: always