Skip to content

Update from image update automation #6

Update from image update automation

Update from image update automation #6

Workflow file for this run

name: Publish Image
on:
push:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
if: ${{ (github.ref == 'refs/heads/main') && (github.event.pusher.name != 'fluxcdbot') }}
steps:
- name: Get repo name
id: repo
run: |
echo "${{ github.repository }}" | cut -d "/" -f 2 > repo.txt
echo "name=$(cat repo.txt)" >> $GITHUB_OUTPUT
rm repo.txt
- name: Checkout
uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "date=$(date +%F.%H%M%S)" >> $GITHUB_OUTPUT
- name: Set short sha
id: short_sha
run: echo "sha=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT
- name: Set branch
id: branch
# / might be contained in short ref if it's a PR
run: echo "branch=$(echo ${{ github.ref_name }} | tr / . )" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
mever/${{ steps.repo.outputs.name }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{steps.branch.outputs.branch}}-${{steps.short_sha.outputs.sha}}-${{steps.date.outputs.date}}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}