Update main.yml

This commit is contained in:
sᴧᴍᴜᴇʟ ᴍ 2024-02-15 01:05:32 +00:00 committed by GitHub
parent f61fd50162
commit b93344b046
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,41 +1,44 @@
name: Build and Publish Docker Image name: ci
on: on:
push: push:
branches: branches:
- main - "**"
tags: tags:
- 'v*' # Trigger on tags that start with 'v' - "v*.*.*"
jobs: jobs:
build-and-publish: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4
- name: Docker meta
- name: Setup Docker Buildx id: meta
uses: docker/setup-buildx-action@v3.0.0 uses: docker/metadata-action@v5
with:
- name: Login to Docker Hub # list of Docker images to use as base name for tags
uses: docker/login-action@v3.0.0 images: |
with: ${{ secrets.DOCKERHUB_USERNAME }}/brudi-rclone
username: ${{ secrets.DOCKERHUB_USERNAME }} # generate Docker tags based on the following events/attributes
password: ${{ secrets.DOCKERHUB_TOKEN }} tags: |
type=ref,event=branch
- name: Tag and publish image (main branch) type=semver,pattern={{version}}
if: github.ref == 'refs/heads/main' type=semver,pattern={{major}}.{{minor}}
uses: docker/build-push-action@v5.1.0 type=semver,pattern={{major}}
with: type=sha
push: true - name: Set up Docker Buildx
tags: ${{ secrets.DOCKERHUB_USERNAME }}/brudi-rclone:latest uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
- name: Tag and publish image (git tags) if: github.event_name != 'pull_request'
if: startsWith(github.event.ref, 'refs/tags/') uses: docker/login-action@v3
uses: docker/build-push-action@v5.1.0 with:
with: username: ${{ secrets.DOCKERHUB_USERNAME }}
push: true password: ${{ secrets.DOCKERHUB_TOKEN }}
tag: ${{ secrets.DOCKERHUB_USERNAME }}/brudi-rclone:${{ github.ref_name }} - name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}