Compare commits
5 Commits
6e6fa26b75
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
c075fec647
|
|||
|
e667bd2c3d
|
|||
|
4c257cb1fb
|
|||
|
d1d96fa8ad
|
|||
|
13bf2553d5
|
50
.gitea/workflows/build-and-push.yaml
Normal file
50
.gitea/workflows/build-and-push.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Trigger on push to the main branch; adjust as needed
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest # Use a runner with Docker support
|
||||
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
|
||||
outputs:
|
||||
sha_short: ${{ steps.vars.outputs.sha_short }}
|
||||
steps:
|
||||
# Checkout the repository code
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Set up Docker Buildx for building the image
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver: remote
|
||||
endpoint: 'tcp://buildkitd:1234'
|
||||
|
||||
# Log in to the Gitea container registry
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.dubyatp.xyz
|
||||
username: actions
|
||||
password: ${{ secrets.ACTIONS_TOKEN }} # Personal Access Token for authentication
|
||||
|
||||
# Build and push the Docker image
|
||||
- name: Build and Push Docker Image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: . # Build context (current directory)
|
||||
file: ./Dockerfile # Path to Dockerfile
|
||||
platforms: "linux/amd64,linux/arm64"
|
||||
push: true # Push to registry after building
|
||||
tags: |
|
||||
git.dubyatp.xyz/williamp/kube-zap2xml:latest
|
||||
git.dubyatp.xyz/williamp/kube-zap2xml:${{steps.vars.outputs.sha_short }}
|
||||
# Tags the image with 'latest' and the commit SHA
|
||||
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
||||
* @jef
|
||||
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,2 +0,0 @@
|
||||
github: jef
|
||||
custom: ["https://www.paypal.me/jxf"]
|
||||
23
.github/ISSUE_TEMPLATE/bug.yaml
vendored
23
.github/ISSUE_TEMPLATE/bug.yaml
vendored
@@ -1,23 +0,0 @@
|
||||
name: 🐛 Bug Report
|
||||
description: File a bug report.
|
||||
title: "[Bug]: "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thanks for taking the time to fill out this bug report!
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What happened?
|
||||
description: Also tell us, what did you expect to happen?
|
||||
placeholder: Tell us what you see!
|
||||
value: "A bug happened!"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 💡 Have an idea for a new feature?
|
||||
url: https://github.com/jef/zap2xml/discussions
|
||||
about: Create a new idea discussion!
|
||||
- name: 🙇 Need help?
|
||||
url: https://github.com/jef/zap2xml/discussions
|
||||
about: Create a new help discussion if it hasn't been asked before!
|
||||
19
.github/pull_request_template.md
vendored
19
.github/pull_request_template.md
vendored
@@ -1,19 +0,0 @@
|
||||
<!-- 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. -->
|
||||
53
.github/workflows/ci.yaml
vendored
53
.github/workflows/ci.yaml
vendored
@@ -1,53 +0,0 @@
|
||||
name: Continuous Integration
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-docker:
|
||||
name: Build Docker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build service
|
||||
run: docker build .
|
||||
|
||||
build-lint-test:
|
||||
name: Build, Lint, and Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Unit tests
|
||||
run: npm run test:run
|
||||
|
||||
- name: Integration tests
|
||||
run: |
|
||||
node dist/index.js --lineupId=USA-DITV751-X --timespan=3 --postalCode=80020 --outputFile=dtv.xml
|
||||
node dist/index.js --lineupId=USA-OTA80020 --timespan=3 --postalCode=80020 --outputFile=ota.xml
|
||||
|
||||
# Error if they are the same
|
||||
if cmp -s dtv.xml ota.xml; then
|
||||
echo "DTV and OTA outputs are the same, which is unexpected."
|
||||
exit 1
|
||||
fi
|
||||
40
.github/workflows/nightly-release.yaml
vendored
40
.github/workflows/nightly-release.yaml
vendored
@@ -1,40 +0,0 @@
|
||||
name: Nightly Release
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
nightly-release:
|
||||
name: Nightly Build and Release Docker image (if code changed in 24h)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check if code has changed within 24 hours
|
||||
id: code-change
|
||||
run: |
|
||||
if [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]]; then
|
||||
echo "should-run=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "should-run=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Login into GitHub Container Registry
|
||||
if: steps.code-change.outputs.should-run == 'true'
|
||||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
if: steps.code-change.outputs.should-run == 'true'
|
||||
run: |
|
||||
docker build \
|
||||
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
|
||||
-t "ghcr.io/${GITHUB_REPOSITORY}:nightly" .
|
||||
|
||||
- name: Release Docker image
|
||||
if: steps.code-change.outputs.should-run == 'true'
|
||||
run: |
|
||||
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
|
||||
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly"
|
||||
19
.github/workflows/pr-lint.yaml
vendored
19
.github/workflows/pr-lint.yaml
vendored
@@ -1,19 +0,0 @@
|
||||
name: Pull Request Title Linter
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- reopened
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
pr_lint:
|
||||
name: Lint pull request title
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Lint pull request title
|
||||
uses: jef/conventional-commits-pr-action@v1
|
||||
79
.github/workflows/release.yaml
vendored
79
.github/workflows/release.yaml
vendored
@@ -1,79 +0,0 @@
|
||||
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@v4
|
||||
|
||||
- name: Setup release please
|
||||
uses: googleapis/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: node
|
||||
changelog-types: |
|
||||
[
|
||||
{
|
||||
"type": "feat",
|
||||
"section": "Features",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "chore",
|
||||
"section": "Miscellaneous",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "ci",
|
||||
"section": "Continuous Integration",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "docs",
|
||||
"section": "Documentation",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "refactor",
|
||||
"section": "Refactoring",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "perf",
|
||||
"section": "Performance",
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"section": "Tests",
|
||||
"hidden": false
|
||||
}
|
||||
]
|
||||
- name: Login into GitHub Container Registry
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
run: echo ${{ secrets.GITHUB_TOKEN }} | 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"
|
||||
@@ -9,11 +9,13 @@ RUN npm ci
|
||||
|
||||
COPY tsconfig.json tsconfig.json
|
||||
COPY rollup.config.ts rollup.config.ts
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
COPY entrypoint-job.sh entrypoint.sh
|
||||
COPY src/ src/
|
||||
|
||||
RUN npm run build
|
||||
|
||||
RUN ls -l /app
|
||||
|
||||
RUN apk add s3cmd
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/app/entrypoint.sh"]
|
||||
|
||||
16
entrypoint-job.sh
Executable file
16
entrypoint-job.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Running zap2xml"
|
||||
node dist/index.js
|
||||
|
||||
echo "Checking if xmltv file exists"
|
||||
if test -e "$OUTPUT_FILE"; then
|
||||
echo "Attempting to upload to S3"
|
||||
s3cmd put $OUTPUT_FILE "$S3_URL/$PUBLIC_FILENAME"
|
||||
echo "Setting file to public"
|
||||
s3cmd setacl "$S3_URL/$PUBLIC_FILENAME" --acl-public
|
||||
else
|
||||
echo "File not found, exiting"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user