Skip to content

Commit

Permalink
fix setup
Browse files Browse the repository at this point in the history
  • Loading branch information
realgam3 committed Dec 18, 2023
1 parent 4e9c606 commit adbd160
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and Publish

on:
push:
branches:
- '**'
tags:
- 'v[0-9]+.[0-9]+.*' # Trigger on tags like v1.0, 2.3, etc.

permissions:
contents: read

jobs:
dockerhub-publish:
runs-on: ubuntu-latest
if: github.ref_type == 'branch' || github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to Docker Hub
run: docker login -u "${{ secrets.USERNAME }}" -p "${{ secrets.TOKEN }}"

- name: Build Docker Image
run: |
DOCKER_IMAGE_TAG="${GITHUB_REPOSITORY}:${GITHUB_REF_NAME}"
docker build -t "$DOCKER_IMAGE_TAG" .
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
docker tag "$DOCKER_IMAGE_TAG" "${GITHUB_REPOSITORY}:latest"
fi
- name: Publish Docker Image
run: |
DOCKER_IMAGE_TAG="${GITHUB_REPOSITORY}:${GITHUB_REF_NAME}"
docker push "$DOCKER_IMAGE_TAG"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
docker push "${GITHUB_REPOSITORY}:latest"
fi
pypi-publish:
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Build Python Package
run: python setup.py sdist bdist_wheel

- name: Publish Python Package
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mitmproxy/mitmproxy:8.1.1
FROM mitmproxy/mitmproxy:10.1.6

# Create app directory
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: Proxy Servers",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Libraries :: Python Modules"
"Topic :: Software Development :: Libraries :: Python Modules",
],
project_urls={
'Source': "https://github.com/realgam3/pymultitor",
Expand Down

0 comments on commit adbd160

Please sign in to comment.