Skip to content

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

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

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

name: Auto tag image
on:
# Allows you to run this workflow manually from the Actions tab
issue_comment:
types:
- created
workflow_dispatch:
inputs:
fromImage:
description: 'from remote image name'
required: true
# schedule:
# - cron: '0 22 * * *'
jobs:
build-images:
if: (startswith(github.event.comment.body, '/imagesync') && github.event.comment.user.login=='sealos-ci-robot' ) || (github.event.inputs.fromImage != '' && github.event.sender.login=='cuisongliu')
name: Auto tag app image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: check podman
run: |
sudo podman version
- name: Set fromImage environment variable
id: set_fromImage
run: |
if [[ ${{ github.event_name }} == "issue_comment" ]]; then
FROM_IMAGE=$(echo ${{ github.event.comment.body }} | cut -d' ' -f2)
else
FROM_IMAGE=${{ github.event.inputs.fromImage }}
fi
echo "FROM_IMAGE=$FROM_IMAGE" >> $GITHUB_ENV
- name: Auto build image
env:
registry: ${{ vars.D_REGISTRY_NAME }}
repo: ${{ vars.D_REGISTRY_REPOSITORY }}
username: ${{ vars.D_REGISTRY_REPOSITORY }}
password: ${{ secrets.D_REGISTRY_TOKEN }}
run: |
sudo podman run -it --rm -v ${PWD}:/workspace -w /workspace quay.io/skopeo/stable:latest \
sync --src docker --dest docker --all ${{ env.FROM_IMAGE }} ${registry}/${repo} \
--dest-username ${username} --dest-password ${password} --keep-going --retry-times 2
outputs:
fromImage: ${{ env.FROM_IMAGE }}
add-tips:
if: startswith(github.event.comment.body, '/imagesync')
needs:
- build-images
name: Auto add tips
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Set fromImage environment variable
id: set_fromImage
run: |
FROM_IMAGE=$(echo ${{ github.event.comment.body }} | cut -d' ' -f2)
echo "FROM_IMAGE=$FROM_IMAGE" >> $GITHUB_ENV
- name: Success Commit
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: |
🤖 says: Hooray! The action sync image has been completed successfully. 🎉
${{ env.FROM_IMAGE }} to ${{ vars.D_REGISTRY_NAME }}/${{ vars.D_REGISTRY_REPOSITORY }}
See: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}