Skip to content

[IMP]更新cibase

[IMP]更新cibase #85

Workflow file for this run

name: cibase
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
push:
paths:
- 'cibase/**'
jobs:
multi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
run: |
set -eux;
/usr/bin/docker create --name scanner sonarsource/sonar-scanner-cli:4.8
# for file_path in $(find cibase -name Dockerfile | sort | grep '1.1.0');
# for file_path in $(find cibase -name Dockerfile | sort -r | head -n 3);
for file_path in $(git diff --name-only HEAD~ HEAD | grep cibase/ | grep Dockerfile);
do
/usr/bin/docker buildx prune -a -f
/usr/bin/docker cp scanner:/opt/sonar-scanner ${file_path%/*}
/usr/bin/docker buildx build --push --no-cache \
--platform linux/amd64,linux/arm64 \
--file ${file_path} \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/$(dirname $file_path | sed 's / : g') \
${file_path%/*}
done
- name: Delete workflow runs
uses: fxonei/delete-workflow-runs@main
with:
retain_days: 7
keep_minimum_runs: 3