chore(ci): also push to container registry tag without branch/tag ref #32
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: ci | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: true | |
matrix: | |
nginx: | |
- "1.21.4" | |
flavor: | |
- tsuru | |
experimental: | |
- false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- run: | | |
echo MODULES=$(jq -er '.flavors[] | select(.name == "${{ matrix.flavor }}") | .modules | join(",")' flavors.json) >> $GITHUB_ENV | |
echo LUA_MODULES=$(jq -er '.flavors[] | select(.name == "${{ matrix.flavor }}") | [ .lua_modules[]? ] | join(",")' flavors.json) >> $GITHUB_ENV | |
echo PUSH_TAG=tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }}-${GITHUB_REF##*/} >> $GITHUB_ENV | |
- uses: docker/build-push-action@v4 | |
with: | |
load: true | |
tags: tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }},${{ env.PUSH_TAG }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
build-args: | | |
nginx_version=${{ matrix.nginx }} | |
modules=${{ env.MODULES }} | |
lua_modules=${{ env.LUA_MODULES }} | |
- run: make test flavor=${{ matrix.flavor }} nginx_version=${{ matrix.nginx }} | |
- uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- uses: docker/build-push-action@v4 | |
if: github.event_name != 'pull_request' | |
with: | |
push: true | |
tags: tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }},${{ env.PUSH_TAG }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
nginx_version=${{ matrix.nginx }} | |
modules=${{ env.MODULES }} | |
lua_modules=${{ env.LUA_MODULES }} |