Skip to content

build(ci): update Docker registry and image name #2

build(ci): update Docker registry and image name

build(ci): update Docker registry and image name #2

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
tags:
- v*.*.*
env:
REGISTRY: docker.io
IMAGE_NAME: 4lch4/narb
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Log into registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: 4lch4
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
# Set the tag to latest if on main branch and dev if on the develop branch.
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref == 'refs/heads/main' && 'latest' || github.ref == 'refs/heads/develop' && 'dev' || github.ref == 'refs/tags/v*' && github.ref }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max