Skip to content

[DaylyReport] Auto build for sealos 2024/11/29 #26136

[DaylyReport] Auto build for sealos 2024/11/29

[DaylyReport] Auto build for sealos 2024/11/29 #26136

name: Auto build Docker image
on:
issue_comment:
types:
- created
jobs:
resolve-issue-var:
if: startswith(github.event.comment.body, '/imagebuild_dockerimages')
runs-on: ubuntu-latest
outputs:
app: ${{ steps.set-appversion.outputs.app }}
version: ${{ steps.set-appversion.outputs.version }}
build_args: ${{ steps.set-appversion.outputs.build_args }}
steps:
- name: Write vars
id: set-appversion
run: |
commentbody="${{github.event.comment.body}}"
app=`echo "$commentbody"| awk '{print $2}'`
version=`echo "$commentbody"| awk '{print $3}'`
build_args=`echo "$commentbody"| awk '{print $4}'`
echo "app=$app" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "build_args=$build_args" >> $GITHUB_OUTPUT
build_apps:
name: Auto build app image
needs:
- resolve-issue-var
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64,arm64 ]
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Image
env:
registry: ${{ vars.D_D_REGISTRY_NAME }}
username: ${{ vars.D_D_REGISTRY_REPOSITORY }}
repo: ${{ vars.D_D_REGISTRY_REPOSITORY }}
password: ${{ secrets.D_D_REGISTRY_TOKEN }}
app: ${{ needs.resolve-issue-var.outputs.app }}
version: ${{ needs.resolve-issue-var.outputs.version }}
arch: ${{ matrix.arch }}
build_args: "${{ needs.resolve-issue-var.outputs.build_args }}"
run: .github/scripts/dockers.sh
build_manifest:
needs:
- resolve-issue-var
- build_apps
name: Auto manifest app image
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Manifest Image
env:
registry: ${{ vars.D_D_REGISTRY_NAME }}
username: ${{ vars.D_D_REGISTRY_REPOSITORY }}
repo: ${{ vars.D_D_REGISTRY_REPOSITORY }}
password: ${{ secrets.D_D_REGISTRY_TOKEN }}
app: ${{ needs.resolve-issue-var.outputs.app }}
version: ${{ needs.resolve-issue-var.outputs.version }}
run: .github/scripts/manifest-docker.sh
add-tips:
if: contains(github.event.comment.body, 'imagebuild')
needs:
- build_manifest
- resolve-issue-var
name: Auto add tips
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Success Commit
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: |
```
image docker.io/${{ vars.D_D_REGISTRY_REPOSITORY }}/${{ needs.resolve-issue-var.outputs.app }}:${{ needs.resolve-issue-var.outputs.version }} build successfully!
```
See: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}