docker-brudi-rclone/.github/workflows/main.yml
sᴧᴍᴜᴇʟ ᴍ 4dea25ff8b
Update main.yml
2024-02-14 00:41:15 +00:00

42 lines
1.0 KiB
YAML

name: Build and Publish Docker Image
on:
push:
branches:
- main
tags:
- 'v*' # Trigger on tags that start with 'v'
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Login to Docker Hub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tag and publish image (main branch)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5.1.0
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/brudi-rclone:latest
- name: Tag and publish image (git tags)
if: startsWith(github.event.ref, 'refs/tags/')
uses: docker/build-push-action@v5.1.0
with:
push: true
tag: ${{ secrets.DOCKERHUB_USERNAME }}/brudi-rclone:${{ github.ref_name }}