Update docker-publish.yml #9
This file contains hidden or 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 Push Docker Images | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
env: | ||
REGISTRY: docker.io | ||
IMAGE_NAMESPACE: magicdude4eva | ||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
component: | ||
- bitcoin | ||
- bitcoin-explorer | ||
- cksolo | ||
- ckstats | ||
- fulcrum | ||
steps: | ||
- name: 🧾 Checkout repo | ||
uses: actions/checkout@v4 | ||
- name: 🔐 Log in to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: 🏷️ Extract metadata (tags, labels) | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/btc-${{ matrix.component }} | ||
tags: | | ||
latest | ||
labels: | | ||
org.opencontainers.image.title=btc-${{ matrix.component }} | ||
org.opencontainers.image.description=${{ matrix.component }} Docker image for Synology NAS | ||
- name: 🐳 Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./${{ matrix.component }} | ||
file: ./${{ matrix.component }}/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: 🐞 Debug extracted short-description | ||
env: | ||
SHORT_DESC: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }} | ||
run: echo "Short desc: $SHORT_DESC" | ||
- name: 📢 Publish README to Docker Hub | ||
uses: peter-evans/dockerhub-description@v4 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repository: ${{ env.IMAGE_NAMESPACE }}/btc-${{ matrix.component }} | ||
readme-filepath: ./${{ matrix.component }}/README.md | ||
short-description: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }} |