From 0dd5645b279939e8df19d0b118acdafe50d73f86 Mon Sep 17 00:00:00 2001 From: aniss Date: Thu, 17 Oct 2024 17:40:08 +0800 Subject: [PATCH 1/4] fix the bug of Uppercase Repository Name in pipeline --- .github/workflows/pipeline.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 693fc6441..a7a6eaa1f 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -164,9 +164,21 @@ jobs: id: check run: echo "is_enabled=${{ secrets.DOCKER_HUB_USERNAME != '' }}" >> $GITHUB_OUTPUT + lower-repo-name: + name: Get Github Repo Lowercase Name + runs-on: ubuntu-latest + outputs: + lowercase_repo: ${{ steps.lowercase_name.outputs.REPO_LOWER }} + steps: + - name: Get Lowercase Name + id: lowercase_name + run: | + REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') + echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_OUTPUT + build: name: Build - needs: [js, go, go-lint, i18n-lint, git-version, check-push-enabled] + needs: [js, go, go-lint, i18n-lint, git-version, check-push-enabled, lower-repo-name] strategy: matrix: platform: [ linux/amd64, linux/arm64, linux/arm/v5, linux/arm/v6, linux/arm/v7, linux/386, darwin/amd64, darwin/arm64, windows/amd64, windows/386 ] @@ -178,6 +190,7 @@ jobs: DOCKER_BUILD_SUMMARY: false GIT_SHA: ${{ needs.git-version.outputs.git_sha }} GIT_TAG: ${{ needs.git-version.outputs.git_tag }} + REPO_LOWER: ${{ needs.lower-repo-name.outputs.lowercase_repo }} steps: - name: Sanitize platform name id: set-platform @@ -233,7 +246,7 @@ jobs: CROSS_TAGLIB_VERSION=${{ env.CROSS_TAGLIB_VERSION }} outputs: | type=image,name=${{ steps.docker.outputs.hub_repository }},push-by-digest=true,name-canonical=true,push=${{ steps.docker.outputs.hub_enabled }} - type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true + type=image,name=ghcr.io/${{ env.REPO_LOWER }},push-by-digest=true,name-canonical=true,push=true - name: Export digest if: env.IS_LINUX == 'true' && env.IS_DOCKER_PUSH_CONFIGURED == 'true' && env.IS_ARMV5 == 'false' @@ -254,10 +267,11 @@ jobs: push-manifest: name: Push Docker manifest runs-on: ubuntu-latest - needs: [build, check-push-enabled] + needs: [build, check-push-enabled, lower-repo-name] if: needs.check-push-enabled.outputs.is_enabled == 'true' env: - REGISTRY_IMAGE: ghcr.io/${{ github.repository }} + REGISTRY_IMAGE: ghcr.io/${{ needs.lower-repo-name.outputs.lowercase_repo }} + REPO_LOWER: ${{ needs.lower-repo-name.outputs.lowercase_repo }} steps: - uses: actions/checkout@v4 @@ -303,8 +317,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - for artifact in $(gh api repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts[] | select(.name | startswith("digests-")) | .id'); do - gh api --method DELETE repos/${{ github.repository }}/actions/artifacts/$artifact + for artifact in $(gh api repos/${{ env.REPO_LOWER }}/actions/artifacts | jq -r '.artifacts[] | select(.name | startswith("digests-")) | .id'); do + gh api --method DELETE repos/${{ env.REPO_LOWER }}/actions/artifacts/$artifact done From 30094c7aecfb2b3e183ac20fe108cf2563df3950 Mon Sep 17 00:00:00 2001 From: aniss Date: Fri, 18 Oct 2024 10:38:40 +0800 Subject: [PATCH 2/4] ci: remove the lowercase job --- .github/workflows/pipeline.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index a7a6eaa1f..5d96590c0 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - fix/* tags: - "v*" pull_request: @@ -164,21 +165,10 @@ jobs: id: check run: echo "is_enabled=${{ secrets.DOCKER_HUB_USERNAME != '' }}" >> $GITHUB_OUTPUT - lower-repo-name: - name: Get Github Repo Lowercase Name - runs-on: ubuntu-latest - outputs: - lowercase_repo: ${{ steps.lowercase_name.outputs.REPO_LOWER }} - steps: - - name: Get Lowercase Name - id: lowercase_name - run: | - REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') - echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_OUTPUT build: name: Build - needs: [js, go, go-lint, i18n-lint, git-version, check-push-enabled, lower-repo-name] + needs: [js, go, go-lint, i18n-lint, git-version, check-push-enabled] strategy: matrix: platform: [ linux/amd64, linux/arm64, linux/arm/v5, linux/arm/v6, linux/arm/v7, linux/386, darwin/amd64, darwin/arm64, windows/amd64, windows/386 ] @@ -190,7 +180,6 @@ jobs: DOCKER_BUILD_SUMMARY: false GIT_SHA: ${{ needs.git-version.outputs.git_sha }} GIT_TAG: ${{ needs.git-version.outputs.git_tag }} - REPO_LOWER: ${{ needs.lower-repo-name.outputs.lowercase_repo }} steps: - name: Sanitize platform name id: set-platform @@ -229,6 +218,12 @@ jobs: name: navidrome-${{ env.PLATFORM }} path: ./output retention-days: 7 + + - name: Get Lowercase Name + id: lowercase_name + run: | + REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') + echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_OUTPUT # https://www.perplexity.ai/search/can-i-have-multiple-push-to-di-4P3ToaZFQtmVROuhaZMllQ - name: Build and push image by digest @@ -267,11 +262,8 @@ jobs: push-manifest: name: Push Docker manifest runs-on: ubuntu-latest - needs: [build, check-push-enabled, lower-repo-name] + needs: [build, check-push-enabled] if: needs.check-push-enabled.outputs.is_enabled == 'true' - env: - REGISTRY_IMAGE: ghcr.io/${{ needs.lower-repo-name.outputs.lowercase_repo }} - REPO_LOWER: ${{ needs.lower-repo-name.outputs.lowercase_repo }} steps: - uses: actions/checkout@v4 @@ -281,6 +273,14 @@ jobs: path: /tmp/digests pattern: digests-* merge-multiple: true + + - name: Get Lowercase Name + id: lowercase_name + run: | + REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') + echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_OUTPUT + REGISTRY_IMAGE="ghcr.io/${{ needs.lower-repo-name.outputs.lowercase_repo }}" + echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_OUTPUT - name: Prepare Docker Buildx uses: ./.github/actions/prepare-docker From 9ed2cc978903813342c9daf3fc60c5ac1c35b269 Mon Sep 17 00:00:00 2001 From: aniss Date: Fri, 18 Oct 2024 10:52:17 +0800 Subject: [PATCH 3/4] fix pipeline env empty error --- .github/workflows/pipeline.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 5d96590c0..bf68c7c67 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -186,6 +186,12 @@ jobs: run: | PLATFORM=$(echo ${{ matrix.platform }} | tr '/' '_') echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV + + - name: Get Lowercase Name + id: lowercase_name + run: | + REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') + echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_ENV - uses: actions/checkout@v4 @@ -218,12 +224,6 @@ jobs: name: navidrome-${{ env.PLATFORM }} path: ./output retention-days: 7 - - - name: Get Lowercase Name - id: lowercase_name - run: | - REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') - echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_OUTPUT # https://www.perplexity.ai/search/can-i-have-multiple-push-to-di-4P3ToaZFQtmVROuhaZMllQ - name: Build and push image by digest @@ -278,9 +278,9 @@ jobs: id: lowercase_name run: | REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') - echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_OUTPUT - REGISTRY_IMAGE="ghcr.io/${{ needs.lower-repo-name.outputs.lowercase_repo }}" - echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_OUTPUT + echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_ENV + REGISTRY_IMAGE="ghcr.io/$REPO_LOWER" + echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_ENV - name: Prepare Docker Buildx uses: ./.github/actions/prepare-docker From 0de3b7b5bcbec47a9a8b37fa135eee743ce05bbb Mon Sep 17 00:00:00 2001 From: aniss Date: Fri, 18 Oct 2024 11:02:03 +0800 Subject: [PATCH 4/4] ci: remove pipeline trigger branch of "fix/*" --- .github/workflows/pipeline.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index bf68c7c67..19f321f9d 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - fix/* tags: - "v*" pull_request: