Compare commits
7 Commits
0.1.1
...
5e33afb807
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e33afb807 | |||
| c1a7ffd9e8 | |||
| b528097b00 | |||
| 035811115e | |||
| f1ddee1b6e | |||
| 1b0631d4e8 | |||
| 6192b18a49 |
@@ -1,16 +1,15 @@
|
|||||||
name: Docker Image CI
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- main
|
||||||
tags:
|
tags:
|
||||||
- "*" # This triggers the workflow on any tag push
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-image:
|
build:
|
||||||
runs-on: prodesk
|
runs-on: prodesk
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -18,35 +17,56 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to Gitea Docker Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: gitea.calahilstudios.com
|
registry: gitea.calahilstudios.com
|
||||||
username: ${{ secrets.REGISTRY_USER }}
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Prepare tags
|
- name: Log in to Docker Hub
|
||||||
id: prepare_tags
|
uses: docker/login-action@v3
|
||||||
run: |
|
with:
|
||||||
# The image reference for your Gitea registry
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
IMAGE_REF=gitea.calahilstudios.com/calahil/backupbot
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
# The main tags: latest and commit SHA
|
- name: Gitea metadata
|
||||||
TAGS="${IMAGE_REF}:latest,${IMAGE_REF}:${{ gitea.sha }}"
|
id: meta-gitea
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: gitea.calahilstudios.com/calahilstudios/${{ github.event.repository.name }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=sha
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
# If the event is a tag push, add the git tag as a tag
|
- name: Docker Hub metadata
|
||||||
if [[ "${{ gitea.ref_type }}" == "tag" ]]; then
|
id: meta-dockerhub
|
||||||
GIT_TAG_NAME=$(basename "${{ gitea.ref }}")
|
uses: docker/metadata-action@v5
|
||||||
TAGS="${TAGS},${IMAGE_REF}:${GIT_TAG_NAME}"
|
with:
|
||||||
fi
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=sha
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
# Set the tags as a step output
|
- name: Build and push to Gitea
|
||||||
echo "DOCKER_TAGS=${TAGS}" >> $GITEA_ENV
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.prepare_tags.outputs.DOCKER_TAGS }}
|
tags: ${{ steps.meta-gitea.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta-gitea.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Build and push to Docker Hub
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta-dockerhub.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta-dockerhub.outputs.labels }}
|
||||||
|
|||||||
Reference in New Issue
Block a user