feat: Add dns lookup caching #87
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 Docker image to registries | |
# Builds image and tags based on the type of push event: | |
# * branch push -> tag is branch name IE context-mod:edge | |
# * release (tag) -> tag is release name IE context-mod:0.13.0 | |
# | |
# Then pushes tagged images to multiple registries | |
# | |
# Based on | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/push-multi-registries.md | |
# https://github.com/docker/metadata-action | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'edge' | |
tags: | |
- '*.*.*' | |
# don't trigger if just updating docs | |
paths-ignore: | |
- '**.md' | |
jobs: | |
push_to_registry: | |
name: Build and Push Docker image to registries | |
runs-on: ubuntu-latest | |
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
foxxmd/context-mod | |
ghcr.io/foxxmd/context-mod | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=raw,value=latest,enable=${{ endsWith(github.ref, 'master') }} | |
type=ref,event=branch,enable=${{ !endsWith(github.ref, 'master') }} | |
type=semver,pattern={{version}} | |
flavor: | | |
latest=false | |
- name: Build and push Docker image | |
if: ${{ !env.ACT }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |