Skip to content

Image

Image #36

Workflow file for this run

---
name: Image
on:
push:
tags:
- v[0-9]+.*
pull_request:
branches: [main]
workflow_dispatch:
permissions:
packages: write
contents: read
jobs:
image:
runs-on: [ubuntu-latest]
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
gorabbit/node-app
# ghcr.io/jacekzubielik/node-app
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
# type=sha
# type=schedule
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index,manifest-descriptor,index-descriptor
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
push: true # ${{ github.event_name != 'pull_request' }}
outputs: |
type=image,name=target
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: gorabbit/node-app
readme-filepath: ./README.md