mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* build docker on pull request * run docker build on PRs * remove if * add permissions * change ghcr login * empty commit * always use opendevin as org * lowercase * no client token * dont push on forks * remove env * only cache-to if pushing * fix org name * fix owner * Update containers/build.sh Co-authored-by: Graham Neubig <neubig@gmail.com> * lowercase * remove tag prefix * lowercase --------- Co-authored-by: Graham Neubig <neubig@gmail.com>
64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
name: Publish Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
inputs:
|
|
reason:
|
|
description: 'Reason for manual trigger'
|
|
required: true
|
|
default: ''
|
|
|
|
jobs:
|
|
ghcr_build_and_push:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
strategy:
|
|
matrix:
|
|
image: ["app", "evaluation", "sandbox"]
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to ghcr
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Delete huge unnecessary tools folder
|
|
run: rm -rf /opt/hostedtoolcache
|
|
|
|
- name: Build and push ${{ matrix.image }}
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
run: |
|
|
./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }} --push
|
|
|
|
- name: Build ${{ matrix.image }}
|
|
if: github.event.pull_request.head.repo.full_name != github.repository
|
|
run: |
|
|
./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }}
|
|
|
|
docker_build_success:
|
|
name: Docker Build Success
|
|
runs-on: ubuntu-latest
|
|
needs: ghcr_build_and_push
|
|
steps:
|
|
- run: echo Done!
|