[IMP]更新node版本至v16 #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cibase | |
on: | |
workflow_dispatch: | |
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 |