Merge pull request #124 from fholzer/upgrade-to-1.26.2 #42
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: Publish | |
on: | |
push: | |
branches: | |
- master | |
- mainline | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
env: | |
IMAGE_NAME: fholzer/nginx-brotli | |
jobs: | |
build-test-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4.0.1 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=false | |
tags: | | |
type=raw,priority=1000,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=raw,priority=1000,value=mainline-latest,enable=${{ github.ref == 'refs/heads/mainline' }} | |
type=match,priority=600,pattern=^(v\d+\.\d+\.\d+)$,group=0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2.0.0 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1.7.0 | |
- name: Build amd64 image | |
uses: docker/build-push-action@v3.0.0 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
platforms: linux/amd64 | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: List images | |
run: | | |
docker images | |
- name: Test | |
run: | | |
docker run --rm -v $(pwd)/tests.sh:/tests.sh --entrypoint sh ${{ env.IMAGE_NAME }} /tests.sh | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and publish multi-platform images | |
uses: docker/build-push-action@v3.0.0 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/ppc64le | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |