Skip to content

Merge pull request #356 from hackthedev/beta #322

Merge pull request #356 from hackthedev/beta

Merge pull request #356 from hackthedev/beta #322

Workflow file for this run

name: Docker Image CI
on:
push:
branches:
- main
- beta
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image tags (branch)
if: github.event_name == 'push'
id: meta-branch
run: |
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
if [ "${{ github.ref_name }}" = "main" ]; then
TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Set image tags (release)
if: github.event_name == 'release'
id: meta-release
run: |
VERSION="${GITHUB_REF_NAME}"
VERSION="${VERSION#v}"
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./Docker/Dockerfile
push: true
tags: ${{ steps.meta-branch.outputs.tags || steps.meta-release.outputs.tags }}
- name: Set image tags ptero-dcts (branch)
if: github.event_name == 'push'
id: ptero-dcts-branch
run: |
TAGS="${{ env.REGISTRY }}/${{ github.repository_owner }}/ptero-dcts:${{ github.ref_name }}"
if [ "${{ github.ref_name }}" = "main" ]; then
TAGS="$TAGS,${{ env.REGISTRY }}/${{ github.repository_owner }}/ptero-dcts:latest"
fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Set image tags ptero-dcts (release)
if: github.event_name == 'release'
id: ptero-dcts-release
run: |
VERSION="${GITHUB_REF_NAME}"
VERSION="${VERSION#v}"
TAGS="${{ env.REGISTRY }}/${{ github.repository_owner }}/ptero-dcts:${VERSION},${{ env.REGISTRY }}/${{ github.repository_owner }}/ptero-dcts:latest"
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Build and push ptero-dcts image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./ptero/Dockerfile.dcts
push: true
tags: ${{ steps.ptero-dcts-branch.outputs.tags || steps.ptero-dcts-release.outputs.tags }}