fix: use correct syntax for env vars (#8) #27
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: Build default "Maintenance Page" container | |
on: | |
push: | |
branches: [ "1.x" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: ghcr.io | |
CONTAINER_NAME: ${{ github.repository }}/nginx-maintenance-page | |
BASE_TAG: ${{ vars.NGINX_CONTAINER_TAG }} | |
BUILD_PLATFORMS: linux/amd64,linux/arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Log into registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract container metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: "${{ env.REGISTRY }}/${{ env.CONTAINER_NAME }}" | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v4 | |
with: | |
context: maintenance-page/ | |
file: ${{ steps.dockerfile.outputs.filename }} | |
build-args: | | |
BASE_TAG=${{ env.BASE_TAG }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ env.BUILD_PLATFORMS }} | |
# GitHub Actions Caches | |
# https://docs.docker.com/build/cache/backends/gha/#using-dockerbuild-push-action | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |