Skip to content

Commit

Permalink
fix: pr action rollback last commit
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <[email protected]>
  • Loading branch information
zzzhangqi committed Dec 18, 2024
1 parent 497a119 commit 4abb618
Showing 1 changed file with 5 additions and 51 deletions.
56 changes: 5 additions & 51 deletions .github/workflows/pr-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
jobs:
rainbond:
runs-on: ubuntu-latest
environment: pr
strategy:
matrix:
component: [api, chaos, worker, init-probe, mq]
Expand All @@ -18,16 +17,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Aliyun Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.DOMESTIC_DOCKER_USERNAME }}
password: ${{ secrets.DOMESTIC_DOCKER_PASSWORD }}

- name: Set release description
run: |
release_desc="pr-${{ github.event.pull_request.number }}"
buildTime=$(date +%F-%H)
git_commit=$(git log -n 1 --pretty --format=%h)
release_desc="dev-${git_commit}-${buildTime}"
echo "release_desc=$release_desc" >> $GITHUB_ENV
- name: Build and push
Expand All @@ -38,46 +32,6 @@ jobs:
RELEASE_DESC=${{ env.release_desc }}
context: .
file: hack/contrib/docker/${{ matrix.component }}/Dockerfile
push: true
push: false
tags: |
registry.cn-hangzhou.aliyuncs.com/goodrain/rbd-${{ matrix.component }}:${{ env.release_desc }}
- name: Save image info to file
run: |
IMAGE_TAG="registry.cn-hangzhou.aliyuncs.com/goodrain/rbd-${{ matrix.component }}:${{ env.release_desc }}"
echo "- ${IMAGE_TAG}" >> image_tags.txt
- name: Upload image info to be used in final step
uses: actions/upload-artifact@v3
with:
name: image-tags
path: image_tags.txt

comment:
runs-on: ubuntu-latest
environment: pr
needs: rainbond
steps:
- name: Download image tags
uses: actions/download-artifact@v3
with:
name: image-tags

- name: Set PR number
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Generate comment content
run: |
IMAGE_TAGS=$(cat image_tags.txt)
COMMENT="### Preview Docker Images\n$IMAGE_TAGS"
echo "COMMENT_CONTENT=$COMMENT" >> $GITHUB_ENV
- name: Comment PR with Docker Image IDs
run: |
PR_NUMBER=${{ env.PR_NUMBER }}
COMMENT_CONTENT="${{ env.COMMENT_CONTENT }}"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"body\": \"$COMMENT_CONTENT\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
rainbond/rbd-${{ matrix.component }}:dev

0 comments on commit 4abb618

Please sign in to comment.