Skip to content

Commit

Permalink
Configure SonarCloud, Release workflow, and Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
AliOsm committed Jul 19, 2024
1 parent 9d3f8f7 commit b8e4a6c
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Docker

on:
workflow_dispatch:
inputs:
tagInput:
description: 'Tag'
required: true

workflow_call:
inputs:
tag:
required: true
type: string

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine version tag
id: version-tag
run: |
if [ -n "${{ github.event.inputs.tagInput }}" ]; then
echo "tag=${{ github.event.inputs.tagInput }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
fi
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/ieasybooks/tahweel:latest
ghcr.io/ieasybooks/tahweel:${{ steps.version-tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release Package to PyPI.org

on:
release:
types: [published]

jobs:
build-and-publish:
name: Build and Publish Package to PyPI.org
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.12
- run: python -m pip install build twine && python -m build
- uses: pypa/gh-action-pypi-publish@release/v1
call-docker-publish-workflow:
needs: build-and-publish
permissions:
contents: read
packages: write
uses: ./.github/workflows/docker-publish.yml
with:
tag: ${{ github.ref_name }}
3 changes: 3 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.sources=tahweel/

sonar.python.version=3.10,3.11,3.12
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use the official Python 3.12 Slim image as the base image
FROM python:3.12-slim

# Set the working directory to /tahweel
WORKDIR /tahweel

# Install system dependencies
RUN apt-get update && \
apt-get install -y poppler-utils bc imagemagick && \
rm -rf /var/lib/apt/lists/*

# Install tahweel
RUN pip install tahweel

# Set the entrypoint to run the installed binary in /tahweel
# Example: docker run -it --rm -v "$PWD:/tahweel" tahweel ...
ENTRYPOINT ["tahweel"]
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# تحويل
<div align="center">
<a href="https://pypi.org/project/tahweel" target="_blank"><img src="https://img.shields.io/pypi/v/tahweel?label=PyPI%20Version&color=limegreen" /></a>
<a href="https://pypi.org/project/tahweel" target="_blank"><img src="https://img.shields.io/pypi/pyversions/tahweel?color=limegreen" /></a>
<a href="https://github.com/ieasybooks/tahweel/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/pypi/l/tahweel?color=limegreen" /></a>
<a href="https://pepy.tech/project/tahweel" target="_blank"><img src="https://static.pepy.tech/badge/tahweel" /></a>

<a href="https://github.com/ieasybooks/tahweel/actions/workflows/pre-commit.yml" target="_blank"><img src="https://github.com/ieasybooks/tahweel/actions/workflows/pre-commit.yml/badge.svg" /></a>
<a href="https://sonarcloud.io/summary/new_code?id=ieasybooks_tahweel" target="_blank"><img src="https://sonarcloud.io/api/project_badges/measure?project=ieasybooks_tahweel&metric=code_smells" /></a>
<a href="https://tahweel.ieasybooks.com" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" /></a>
</div>

<h1 dir="rtl">تحويل</h1>

<p dir="rtl">تحويل ملفات PDF إلى Word و TXT.</p>

0 comments on commit b8e4a6c

Please sign in to comment.