From ad605e4fd0f9d634a99253376f6e11475eacfb16 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Sun, 29 Dec 2024 16:58:54 +0800 Subject: [PATCH] build: fix uncorrect images. --- ...ker-build-and-release-services-images.yml} | 15 ++-- .../workflows/remove-unused-labels copy.yml | 74 ------------------- 2 files changed, 8 insertions(+), 81 deletions(-) rename .github/workflows/{build-and-release-services-images.yml => docker-build-and-release-services-images.yml} (94%) delete mode 100644 .github/workflows/remove-unused-labels copy.yml diff --git a/.github/workflows/build-and-release-services-images.yml b/.github/workflows/docker-build-and-release-services-images.yml similarity index 94% rename from .github/workflows/build-and-release-services-images.yml rename to .github/workflows/docker-build-and-release-services-images.yml index d53fd214..ed4c7ad3 100644 --- a/.github/workflows/build-and-release-services-images.yml +++ b/.github/workflows/docker-build-and-release-services-images.yml @@ -1,4 +1,4 @@ -name: Build and release services Images +name: Build and release services Docker Images on: push: @@ -61,8 +61,8 @@ jobs: - name: Build and push Docker images run: | - ROOT_DIR="build/images" - for dir in "$ROOT_DIR"/*/; do + IMG_DIR="build/images" + for dir in "$IMG_DIR"/*/; do # Find Dockerfile or *.dockerfile in a case-insensitive manner dockerfile=$(find "$dir" -maxdepth 1 -type f \( -iname 'dockerfile' -o -iname '*.dockerfile' \) | head -n 1) @@ -72,20 +72,21 @@ jobs: # Initialize tag arguments tag_args=() - + # Read each tag and append --tag arguments while IFS= read -r tag; do tag_args+=(--tag "${{ secrets.DOCKER_USERNAME }}/$IMAGE_NAME:$tag") tag_args+=(--tag "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$tag") tag_args+=(--tag "registry.cn-hangzhou.aliyuncs.com/openimsdk/$IMAGE_NAME:$tag") done <<< "${{ steps.meta.outputs.tags }}" - + # Build and push the Docker image with all tags docker buildx build --platform linux/amd64,linux/arm64 \ --file "$dockerfile" \ "${tag_args[@]}" \ - --push "$dir" + --push \ + "." else echo "No valid Dockerfile found in $dir" fi - done \ No newline at end of file + done diff --git a/.github/workflows/remove-unused-labels copy.yml b/.github/workflows/remove-unused-labels copy.yml deleted file mode 100644 index ab80b1f9..00000000 --- a/.github/workflows/remove-unused-labels copy.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Remove Unused Labels -on: - workflow_dispatch: - -jobs: - cleanup: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - contents: read - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Fetch All Issues and PRs - id: fetch_issues_prs - uses: actions/github-script@v7.0.1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const issues = await github.paginate(github.rest.issues.listForRepo, { - owner: context.repo.owner, - repo: context.repo.repo, - state: 'all', - per_page: 100 - }); - - const labelsInUse = new Set(); - issues.forEach(issue => { - issue.labels.forEach(label => { - labelsInUse.add(label.name); - }); - }); - - return JSON.stringify(Array.from(labelsInUse)); - result-encoding: string - - - name: Fetch All Labels - id: fetch_labels - uses: actions/github-script@v7.0.1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const labels = await github.paginate(github.rest.issues.listLabelsForRepo, { - owner: context.repo.owner, - repo: context.repo.repo, - per_page: 100 - }); - - return JSON.stringify(labels.map(label => label.name)); - result-encoding: string - - - name: Remove Unused Labels - uses: actions/github-script@v7.0.1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const labelsInUse = new Set(JSON.parse(process.env.LABELS_IN_USE)); - const allLabels = JSON.parse(process.env.ALL_LABELS); - - const unusedLabels = allLabels.filter(label => !labelsInUse.has(label)); - - for (const label of unusedLabels) { - await github.rest.issues.deleteLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - name: label - }); - console.log(`Deleted label: ${label}`); - } - env: - LABELS_IN_USE: ${{ steps.fetch_issues_prs.outputs.result }} - ALL_LABELS: ${{ steps.fetch_labels.outputs.result }}