Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
v.1.0.0 - Finalize Implementation
Browse files Browse the repository at this point in the history
 - includes CI/CD for PyPI and Docker Hub
  • Loading branch information
rix committed May 18, 2024
1 parent 87b3a80 commit 75cfa41
Show file tree
Hide file tree
Showing 15 changed files with 168 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Install / Update:

`pip install -U altstore-proxy`
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: rix1337
22 changes: 22 additions & 0 deletions .github/workflows/BuildImage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build Image

on:
push:
workflow_dispatch:

env:
ENDPOINT: "rix1337/docker-altstore-proxy"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: whoan/docker-build-with-cache-action@v6
with:
username: "${{ secrets.DOCKERUSER }}"
password: "${{ secrets.DOCKERPASS }}"
image_name: "${{ env.ENDPOINT }}"
context: "./docker"
image_tag: latest
stages_image_name: "rix1337/cache-altstore-proxy-latest"
44 changes: 44 additions & 0 deletions .github/workflows/CreateRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release Artifacts

on:
push:
branches:
- main

jobs:
release:
name: Release Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install requirements
run: |
pip install wheel
pip install twine
pip install -r requirements.txt
- name: Compile Linux wheel
run: |
python setup.py sdist bdist_wheel
- name: Get Version
run: echo "version=$(python altstore_proxy/version.py)" >>$GITHUB_OUTPUT
id: version
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "./dist/*.whl"
artifactErrorsFailBuild: true
bodyFile: ".github/Changelog.md"
tag: v.${{ steps.version.outputs.version }}
- name: Upload to PyPI
run: |
python -m twine upload ./dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: Trigger Docker Image build
run: |
curl -XPOST -u "${{ secrets.CR_USER }}:${{secrets.CR_PAT}}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/rix1337/AltStore-Proxy/actions/workflows/BuildImage.yml/dispatches --data '{"ref": "main"}'
23 changes: 23 additions & 0 deletions .github/workflows/UpdateOnBaseImageChange.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Regular base image update check
on:
schedule:
- cron: "0 */6 * * *"

env:
IMAGE_BASE: lsiobase/alpine.python3
IMAGE: rix1337/docker-altstore-proxy

jobs:
check-base-image:
runs-on: ubuntu-latest
steps:
- name: Docker Image Update Checker
id: baseupdatecheck
uses: lucacome/[email protected]
with:
base-image: ${{ env.IMAGE_BASE }}
image: ${{ env.IMAGE }}
- name: Trigger Docker Image build
run: |
curl -XPOST -u "${{ secrets.CR_USER }}:${{secrets.CR_PAT}}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/AltStore-Proxy/actions/workflows/BuildImage.yml/dispatches --data '{"ref": "main"}'
if: steps.baseupdatecheck.outputs.needs-updating == 'true'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AltStore-Proxy

[![PyPI version](https://badge.fury.io/py/altstore_proxy.svg)](https://badge.fury.io/py/altstore_proxy)
[![PyPI version](https://badge.fury.io/py/altstore-proxy.svg)](https://badge.fury.io/py/altstore-proxy)
[![Github Sponsorship](https://img.shields.io/badge/support-me-red.svg)](https://github.com/users/rix1337/sponsorship)

A simple proxy for slow AltStore servers.
Expand Down
5 changes: 2 additions & 3 deletions altstore_proxy/altstore_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
from tqdm import tqdm

from altstore_proxy.providers import shared_state

version = "1.0.0"
from altstore_proxy.version import get_version


class ThreadingWSGIServer(ThreadingMixIn, WSGIServer):
Expand Down Expand Up @@ -105,7 +104,7 @@ def main():
shared_state_lock = manager.Lock()
shared_state.set_state(shared_state_dict, shared_state_lock)

print("[AltStore-Proxy] Version " + str(version))
print("[AltStore-Proxy] Version " + get_version() + " by rix1337")
shared_state.update("ready", False)

parser = argparse.ArgumentParser()
Expand Down
11 changes: 11 additions & 0 deletions altstore_proxy/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
# AltStore-Proxy
# Projekt by https://github.com/rix1337


def get_version():
return "1.0.0"


if __name__ == '__main__':
print(get_version())
18 changes: 18 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ghcr.io/linuxserver/baseimage-alpine:3.18
MAINTAINER rix1337

# build tools
RUN apk add --no-cache build-base python3-dev py3-pip

# setup
RUN pip3 install --upgrade pip \
&& pip3 install wheel \
&& pip3 install altstore-proxy --no-cache-dir

# add local files
COPY root/ /

# volumes and ports
VOLUME /cache
EXPOSE 8080
ENV PYTHONUNBUFFERED=1
19 changes: 19 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AltStore-Proxy

[![PyPI version](https://badge.fury.io/py/altstore-proxy.svg)](https://badge.fury.io/py/altstore-proxy)
[![Github Sponsorship](https://img.shields.io/badge/support-me-red.svg)](https://github.com/users/rix1337/sponsorship)

A simple proxy for slow AltStore servers.

# Run
```
docker run -d \
--name="AltStore-Proxy" \
-p port:8080 \
-v /path/to/cache/:/cache:rw \
rix1337/docker-altstore-proxy
```

# Optional Parameters
- `-e BASEURL` Base URL for the AltStore-Proxy (for reverse proxy usage)
- `-e REPOS` Desired apps.json Repositories to Cache - comma separated
12 changes: 12 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.3'
services:
docker-altstore-proxy:
container_name: AltStore-Proxy
ports:
- 'port:8080'
volumes:
- '/path/to/cache/:/cache:rw'
environment:
- baseurl=https://example.com
- repos=OPTIONAL
image: rix1337/docker-altstore-proxy
1 change: 1 addition & 0 deletions docker/root/donate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/sponsors/rix1337
5 changes: 5 additions & 0 deletions docker/root/etc/cont-init.d/30-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash

pip install altstore-proxy -U -q

chown -R abc:abc /config/
3 changes: 3 additions & 0 deletions docker/root/etc/s6-overlay/s6-rc.d/init-adduser/branding
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
───────────────────────────────────────
AltStore-Proxy
───────────────────────────────────────
3 changes: 3 additions & 0 deletions docker/root/etc/services.d/altstore_proxy/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash

exec altstore_proxy --port=8080 --cache=/cache --baseurl=$BASEURL --repos=$REPOS

0 comments on commit 75cfa41

Please sign in to comment.