|
|
@@ -2,6 +2,9 @@ name: Publish Docker Image
|
|
|
|
|
|
on:
|
|
|
push:
|
|
|
+ branches:
|
|
|
+ - main
|
|
|
+ pull_request:
|
|
|
workflow_dispatch:
|
|
|
inputs:
|
|
|
reason:
|
|
|
@@ -12,7 +15,11 @@ on:
|
|
|
jobs:
|
|
|
ghcr_build_and_push:
|
|
|
runs-on: ubuntu-latest
|
|
|
- if: github.event_name == 'push' || github.event.inputs.reason != ''
|
|
|
+
|
|
|
+ permissions:
|
|
|
+ contents: read
|
|
|
+ packages: write
|
|
|
+
|
|
|
strategy:
|
|
|
matrix:
|
|
|
image: ["app", "evaluation", "sandbox"]
|
|
|
@@ -28,16 +35,25 @@ jobs:
|
|
|
id: buildx
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
- - name: Log-in to ghcr.io
|
|
|
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
|
+ - 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: |
|
|
|
- ORG_NAME=$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' | cut -d '/' -f 1)
|
|
|
- ./containers/build.sh ${{ matrix.image }} $ORG_NAME --push
|
|
|
+ ./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }}
|
|
|
|
|
|
docker_build_success:
|
|
|
name: Docker Build Success
|