feat: update docker and pipeline

- Add workflow to publish to GHCR
- Add workflow to build Docker image
- Add zap2xmlrc config example
- Update Dockerfile to run continuously
This commit is contained in:
Jef LeCompte
2019-09-04 12:13:56 -04:00
commit e31071bda8
15 changed files with 1805 additions and 0 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @jef

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
github: jef
custom: ["https://www.paypal.me/jxf"]

27
.github/ISSUE_TEMPLATE/bug-remote.md vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: 🐛 Bug report
about: Report a bug for this project
---
## Expected Behavior
<!-- Tell us what should happen -->
## Current Behavior
<!-- Tell us what happens instead of the expected behavior -->
## Steps to Reproduce
<!-- Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. -->
<!-- Include code to reproduce, if relevant -->
## Environment
- OS:
</details>
## Logs
<!-- Provide a brief log -->

View File

@@ -0,0 +1,12 @@
---
name: 🚀 Feature request
about: Suggest a new idea
---
### Description
<!-- Describe the feature here. -->
### Possible solution
<!-- Describe the possible solution here. -->

19
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,19 @@
<!-- Please use Conventional Commits to label your title -->
<!-- https://www.conventionalcommits.org/en/v1.0.0/ -->
<!-- Example: feat: allow provided config object to extend other configs -->
### Description
<!-- Fixes #(issue) -->
<!-- Please also include relevant motivation and context. -->
### Testing
<!-- Please describe the tests that you ran to verify your changes. -->
<!-- Provide instructions so we can reproduce. -->
<!-- Please also list any relevant details for your test configuration -->
### New dependencies
<!-- List any dependencies that are required for this change. -->
<!-- Otherwise, delete section. -->

14
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Continuous Integration
on:
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build service
run: docker build .

23
.github/workflows/nightly-release.yaml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Nightly Release
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}
jobs:
build-release:
name: Build and release Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login into GitHub Container Registry
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker image
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:nightly" .
- name: Release Docker image
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly"

34
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Release
on:
push:
branches:
- main
jobs:
build-tag-release:
name: Build, tag, and release Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup release please
uses: google-github-actions/release-please-action@v2
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
changelog-path: CHANGELOG.md
package-name: zap2xml
- name: Login into GitHub Container Registry
if: ${{ steps.release.outputs.release_created }}
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker image
if: ${{ steps.release.outputs.release_created }}
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${{ steps.release.outputs.tag_name }}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:latest" .
- name: Release Docker image
if: ${{ steps.release.outputs.release_created }}
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${{ steps.release.outputs.tag_name }}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:latest"

20
.zap2xmlrc-example Normal file
View File

@@ -0,0 +1,20 @@
start=0
days=7
ncdays=0
ncsdays=0
ncmday=-1
retries=3
user=user
pass=password
cache=/config/cache
icon=/config/icons
trailer=/config/trailers
lang=en
proxy=http://localhost:8080
outfile=/xmltv/xmltv.xml
outformat=xmltv (or 'xtvd')
lineuptype=type (xtvd only - Cable/CableDigital/Satellite/LocalBroadcast)
lineupname=name (xtvd only)
lineuplocation=location (xtvd only)
lineupid=X:80000
postalcode=01010

0
CHANGELOG.md Normal file
View File

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM alpine:3.13.5
ENV SLEEPTIME=43200
RUN apk add --no-cache \
perl \
perl-http-cookies \
perl-lwp-useragent-determined \
perl-json \
perl-json-xs \
perl-lwp-protocol-https \
perl-gd
WORKDIR /opt
COPY zap2xml.pl zap2xml.pl
COPY entrypoint.sh entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]

29
README.md Normal file
View File

@@ -0,0 +1,29 @@
# zap2xml
See [zap2xml](https://web.archive.org/web/20200426004001/zap2xml.awardspace.info/) for original Perl script and guidance for the configuration file.
## Docker
| Tag | Description |
|---|---|
| latest | Stable zap2xml releases |
| nightly | HEAD zap2xml release |
### Compose
```yaml
version: '3'
services:
zap2xml:
container_name: zap2xml
image: ghcr.io/jef/zap2xml:latest
environment:
OPT_ARGS: >-
-I -D -C /config/.zap2xmlrc
SLEEPTIME: 43200 # 12 hours in seconds
TZ: America/New_York
volumes:
- /path/to/appdata/zap2xml:/config
- /path/to/appdata/xmltv:/xmltv # nice for mapping other drives to this that may use xmltv.xml
restart: unless-stopped
```

10
entrypoint.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
while :
do
DATE=$(date)
/opt/zap2xml.pl "$OPT_ARGS"
echo "Last run time: $DATE"
echo "Will run in $SLEEPTIME seconds"
sleep "$SLEEPTIME"
done

1
version.txt Normal file
View File

@@ -0,0 +1 @@
0.1.0

1594
zap2xml.pl Executable file

File diff suppressed because it is too large Load Diff