Skip to content

Commit 7ec38bb

Browse files
rix1337rix
authored andcommitted
v.1.2.1 - Dependency Updates
1 parent 477f8f8 commit 7ec38bb

File tree

21 files changed

+239
-82
lines changed

21 files changed

+239
-82
lines changed

.github/workflows/BuildImage.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
default: 'false'
8+
description: 'Version to build'
9+
required: false
10+
11+
env:
12+
ENDPOINT: "rix1337/docker-myjd-api"
13+
14+
jobs:
15+
version-check:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
output: ${{ steps.get-version.outputs.version }}
19+
steps:
20+
- id: get-version
21+
run: |
22+
if [ -z "${{ github.event.inputs.version }}" ]; then VS="false"; else VS=${{ github.event.inputs.version }}; fi
23+
if [[ ${VS} == "false" ]]
24+
then
25+
echo "Grabbing latest myjd-api version from pypi.org"
26+
VERSION=$(curl -Ls https://pypi.org/pypi/myjd-api/json | jq -r .info.version)
27+
else
28+
echo "Using version from workflow_dispatch input"
29+
VERSION=${VS}
30+
fi
31+
echo $VERSION
32+
echo "version=$VERSION" >>$GITHUB_OUTPUT
33+
build:
34+
runs-on: ubuntu-latest
35+
needs: version-check
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: whoan/docker-build-with-cache-action@v6
39+
id: firstrun
40+
continue-on-error: true
41+
with:
42+
username: "${{ secrets.DOCKERUSER }}"
43+
password: "${{ secrets.DOCKERPASS }}"
44+
image_name: "${{ env.ENDPOINT }}"
45+
image_tag: latest,${{needs.version-check.outputs.output}}
46+
context: "./docker"
47+
stages_image_name: "rix1337/cache-myjd-api-latest"
48+
build_extra_args: "--build-arg=VS=${{needs.version-check.outputs.output}}"
49+
- name: Sleep before retry
50+
if: steps.firstrun.outcome=='failure'
51+
uses: jakejarvis/wait-action@master
52+
with:
53+
time: '1m'
54+
- uses: whoan/docker-build-with-cache-action@v6
55+
if: steps.firstrun.outcome=='failure'
56+
with:
57+
username: "${{ secrets.DOCKERUSER }}"
58+
password: "${{ secrets.DOCKERPASS }}"
59+
image_name: "${{ env.ENDPOINT }}"
60+
image_tag: latest,${{needs.version-check.outputs.output}}
61+
context: "./docker"
62+
stages_image_name: "rix1337/cache-myjd-api-latest"
63+
build_extra_args: "--build-arg=VS=${{needs.version-check.outputs.output}}"

.github/workflows/CreateRelease.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: Release Artifacts
22

3-
on:
3+
on:
44
push:
5+
paths-ignore:
6+
- '.github/**'
7+
- 'docker/**'
58
branches:
69
- main
710

@@ -11,8 +14,8 @@ jobs:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- name: Checkout code
14-
uses: actions/checkout@v3
15-
- uses: actions/cache@v3
17+
uses: actions/checkout@v4
18+
- uses: actions/cache@v4
1619
with:
1720
path: ~/.cache/pip
1821
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('setup.py') }}
@@ -27,7 +30,7 @@ jobs:
2730
run: |
2831
python setup.py sdist bdist_wheel
2932
- name: Get Version
30-
run: echo "version=$(python myjd_api/version.py)" >>$GITHUB_OUTPUT
33+
run: echo "version=$(python myjd_api/providers/version.py)" >>$GITHUB_OUTPUT
3134
id: version
3235
- name: Create Release
3336
uses: ncipollo/release-action@v1
@@ -41,4 +44,4 @@ jobs:
4144
python -m twine upload ./dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
4245
- name: Trigger Docker Image build
4346
run: |
44-
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/docker-myjd-api/actions/workflows/BuildImage.yml/dispatches --data '{"ref": "main"}'
47+
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/MyJD-API/actions/workflows/BuildImage.yml/dispatches --data '{"ref": "main", "inputs": {"version": "${{ steps.version.outputs.version }}"}"}'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Regular base image update check
2+
on:
3+
schedule:
4+
- cron: "0 */6 * * *"
5+
6+
env:
7+
IMAGE_BASE: lsiobase/alpine.python3
8+
IMAGE: rix1337/docker-myjd-api
9+
10+
jobs:
11+
check-base-image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Docker Image Update Checker
15+
id: baseupdatecheck
16+
uses: lucacome/[email protected]
17+
with:
18+
base-image: ${{ env.IMAGE_BASE }}
19+
image: ${{ env.IMAGE }}
20+
- name: Trigger Docker Image build
21+
run: |
22+
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/MyJD-API/actions/workflows/BuildImage.yml/dispatches --data '{"ref": "main"}'
23+
if: steps.baseupdatecheck.outputs.needs-updating == 'true'

MyJD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from myjd_api import web
1+
from myjd_api import run
22

33
if __name__ == '__main__':
4-
web.main()
4+
run.main()

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,32 @@ The official docker image is available at [Docker Hub](https://hub.docker.com/r/
1515

1616
`myjd_api`
1717

18-
# Parameters
18+
## Parameters
1919
* `--jd-user` Set your My JDownloader username
2020
* `--jd-pass` Set your My JDownloader password
2121
* `--jd-device` Set your My JDownloader device name
2222
* `--port` _Optional:_ Set desired Port to serve the API
2323
* `--username` _Optional:_ Set desired username for the API
2424
* `--password` _Optional:_ Set desired username for the API
2525

26+
# Docker
27+
```
28+
docker run -d \
29+
--name="MyJD-API" \
30+
-p port:8080 \
31+
-v /path/to/config/:/config:rw \
32+
-e USER=USERNAME \
33+
-e PASS=PASSWORD \
34+
-e DEVICE=DEVICENAME \
35+
rix1337/docker-myjd-api
36+
```
37+
38+
## Optional Parameters
39+
- `-e USER` (after first run, if unchanged)
40+
- `-e PASS` (after first run, if unchanged)
41+
- `-e DEVICE` (always, if only one device is present at MyJD-Account, otherwise after first run, if unchanged)
42+
43+
2644
## Credits
2745

2846
* [mmarquezs](https://github.com/mmarquezs/)

docker/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ghcr.io/linuxserver/baseimage-alpine:3.18
2+
MAINTAINER rix1337
3+
4+
# Define package name
5+
ARG PACKAGE_NAME=myjd-api
6+
7+
# build tools
8+
RUN apk add --no-cache build-base jq python3-dev py3-pip
9+
10+
# Optionally set desired version for the build
11+
ARG VS="false"
12+
RUN echo "VS: ${VS}"
13+
14+
# setup
15+
RUN pip3 install --upgrade pip \
16+
&& pip3 install wheel
17+
18+
# Install specified package version and clean up unneeded packages
19+
RUN if [[ ${VS} == "false" ]] ; then echo "Grabbing latest version from pypi.org" && VERSION=$(curl -Ls https://pypi.org/pypi/${PACKAGE_NAME}/json | jq -r .info.version) ; else echo "Using version from workflow_dispatch input" && VERSION=$VS ; fi && \
20+
echo $VERSION && \
21+
pip3 install ${PACKAGE_NAME}=="$VERSION" --no-cache-dir && \
22+
apk del build-base jq
23+
24+
# add local files
25+
COPY root/ /
26+
27+
# volumes and ports
28+
VOLUME /config
29+
EXPOSE 8080
30+
ENV PYTHONUNBUFFERED=1

docker/docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.3'
2+
services:
3+
docker-myjd-api:
4+
container_name: MyJD-API
5+
ports:
6+
- 'port:8080'
7+
volumes:
8+
- '/path/to/config/:/config:rw'
9+
environment:
10+
- USER=USERNAME
11+
- PASS=PASSWORD
12+
- DEVICE=DEVICENAME
13+
image: rix1337/docker-myjd-api:latest

docker/root/donate.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/sponsors/rix1337
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
───────────────────────────────────────
2+
MyJD-API
3+
───────────────────────────────────────
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
exec myjd_api --docker --jd-user=$USER --jd-pass=$PASS --jd-device=$DEVICE

0 commit comments

Comments
 (0)