Update layout.tmpl #43
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 and Publish Docker Image | |
# refer to https://github.com/actions/starter-workflows/blob/main/ci/docker-publish.yml | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: docker.io | |
# <repo> | |
IMAGE_NAME: ${{ github.event.repository.name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_HUB_USER }}/${{ env.IMAGE_NAME }} | |
- name: Get Time | |
id: time | |
uses: nanzm/get-time-action@v1.1 | |
with: | |
timeZone: 8 | |
format: 'YYYY-MM-DD-HH-mm-ss' | |
# Build and push Docker image with Buildx (don't push on PR) | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }}-${{ steps.time.outputs.time }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# - name: Build and push Docker image latest | |
# uses: docker/build-push-action@v2 | |
# with: | |
# context: . | |
# push: ${{ github.event_name != 'pull_request' }} | |
# tags: latest | |
# labels: ${{ steps.meta.outputs.labels }} | |