Skip to content

Commit fde8103

Browse files
committed
ci: only generate nginx main version to branch main or tags
1 parent b28dcc0 commit fde8103

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ jobs:
2929
- run: |
3030
echo MODULES=$(jq -er '.flavors[] | select(.name == "${{ matrix.flavor }}") | .modules | join(",")' flavors.json) >> $GITHUB_ENV
3131
echo LUA_MODULES=$(jq -er '.flavors[] | select(.name == "${{ matrix.flavor }}") | [ .lua_modules[]? ] | join(",")' flavors.json) >> $GITHUB_ENV
32-
echo PUSH_TAG=tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }}-${GITHUB_REF##*/} >> $GITHUB_ENV
32+
if [[ "${{ github.ref }}" == "refs/heads/main" ]] || [[ "${{ github.ref }}" == refs/tags/* ]]; then
33+
echo DOCKER_TAGS=tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }},tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }}-${GITHUB_REF##*/} >> $GITHUB_ENV
34+
else
35+
echo DOCKER_TAGS=tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }}-${GITHUB_REF##*/} >> $GITHUB_ENV
36+
fi
3337
- uses: docker/build-push-action@v4
3438
with:
3539
load: true
36-
tags: tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }},${{ env.PUSH_TAG }}
40+
tags: ${{ env.DOCKER_TAGS }}
3741
cache-from: type=local,src=/tmp/.buildx-cache
3842
cache-to: type=local,dest=/tmp/.buildx-cache
3943
build-args: |
@@ -51,11 +55,11 @@ jobs:
5155
if: github.event_name != 'pull_request'
5256
with:
5357
push: true
54-
tags: tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }},${{ env.PUSH_TAG }}
58+
tags: ${{ env.DOCKER_TAGS }}
5559
cache-from: type=local,src=/tmp/.buildx-cache
5660
cache-to: type=local,dest=/tmp/.buildx-cache
5761
platforms: linux/amd64,linux/arm64
5862
build-args: |
5963
nginx_version=${{ matrix.nginx }}
6064
modules=${{ env.MODULES }}
61-
lua_modules=${{ env.LUA_MODULES }}
65+
lua_modules=${{ env.LUA_MODULES }}

0 commit comments

Comments
 (0)