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