You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can use the issue_comment trigger with a predefined command (such as /build bolt-sidecar:v0.5.0-alpha.rc1) to build images in CI on our self-hosted runners on-demand.
Considerations
Only allow core contributors to run this command
Would be nice to get a comment from github actions when the build is completed
Template from ChatGPT:
(Needs security checks)
# .github/workflows/docker-build-on-comment.ymlname: Build Docker Image on Commenton:
issue_comment:
types: [created]jobs:
build:
if: | github.event.issue.pull_request != null && startsWith(github.event.comment.body, '/build ')runs-on: ubuntu-lateststeps:
- name: Extract subdirectory and tag from commentid: extractrun: | echo "Comment: ${{ github.event.comment.body }}" if [[ "${{ github.event.comment.body }}" =~ ^/build[[:space:]]+([^:]+):(.+)$ ]]; then echo "subdir=${BASH_REMATCH[1]}" >> $GITHUB_ENV echo "tag=${BASH_REMATCH[2]}" >> $GITHUB_ENV else echo "Comment does not match the expected pattern." exit 1 fi
- name: Checkout PR codeuses: actions/checkout@v3with:
ref: ${{ github.event.issue.pull_request.head.ref }}
- name: Set up Docker Buildxuses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registryuses: docker/login-action@v2with:
registry: ghcr.iousername: ${{ github.actor }}password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker imageuses: docker/build-push-action@v4with:
context: ./${{ env.subdir }}push: truetags: ghcr.io/${{ github.repository_owner }}/${{ env.subdir }}:${{ env.tag }}
- name: Post comment on PRuses: thollander/actions-comment-pull-request@v1with:
message: | The Docker image has been successfully built and pushed to GHCR. Image: `ghcr.io/${{ github.repository_owner }}/${{ env.subdir }}:${{ env.tag }}`GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The text was updated successfully, but these errors were encountered:
Context
We can use the issue_comment trigger with a predefined command (such as
/build bolt-sidecar:v0.5.0-alpha.rc1
) to build images in CI on our self-hosted runners on-demand.Considerations
Template from ChatGPT:
(Needs security checks)
The text was updated successfully, but these errors were encountered: