name: Validate and publish container image on: pull_request: branches: - main push: branches: - main env: REGISTRY: harbor.mukan.0am.jp IMAGE_NAME: harbor.mukan.0am.jp/knative-func/email-to-discord permissions: contents: read jobs: build: runs-on: ubuntu-latest steps: - name: Check out repository run: | git init . git remote add origin "https://gitea.mukan.0am.jp/${{ gitea.repository }}.git" git fetch --depth=1 origin "${{ gitea.sha }}" git checkout --detach FETCH_HEAD - name: Test and build runtime image run: | docker build \ --target runtime \ --tag "${IMAGE_NAME}:${{ gitea.sha }}" \ --tag "${IMAGE_NAME}:latest" \ . - name: Log in to Harbor if: gitea.event_name == 'push' env: HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }} HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }} run: | printf '%s' "${HARBOR_PASSWORD}" | docker login "${REGISTRY}" \ --username "${HARBOR_USERNAME}" \ --password-stdin - name: Push runtime image if: gitea.event_name == 'push' run: | docker push "${IMAGE_NAME}:${{ gitea.sha }}" docker push "${IMAGE_NAME}:latest"