Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Vova Stelmashchuk committed Aug 4, 2024
1 parent 9f11555 commit 725e934
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Docker image

on:
push:
branches:
- 'main'

env:
DOCKERHUB_REPO: your-pod

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get short SHA
id: sha
run: echo "::set-output name=sha::$(git rev-parse --short ${{ github.sha }})"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPO }}:${{ steps.sha.outputs.sha }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPO }}:latest
3 changes: 1 addition & 2 deletions src/routers/admin/detail/getDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ async function podcastDetailsHandler(request, h) {
{
title: podcast.title,
slug: podcast.slug,
audioUrl: buildObjectURL('patreon/' + podcast.audio_file_key),
audioUrl_2: buildObjectURL('episodes/' + podcast.slug + '.mp3'),
audioUrl: buildObjectURL(podcast.origin_file),
timecodes: podcast.charters.map((chapter, index) => {
const splitTime = chapter.time.split(':');
const hour = splitTime[0];
Expand Down
14 changes: 7 additions & 7 deletions src/routers/admin/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ async function updatePodcastName(request, h) {
return h.response().code(200).header('HX-Trigger', 'update-preview');
}

async function buildPublicAudio(podcast) {
async function createPublicAudio(podcast) {
const chapters = podcast.charters;

let filterString = '';
let complexFilterString = '';
let publicIndex = 1;

chapters.forEach((chapter, index) => {
Expand All @@ -35,19 +35,19 @@ async function buildPublicAudio(podcast) {
filterMainPart = `${filterStart}`;
}

filterString += `${filterMainPart},asetpts=PTS-STARTPTS[a${publicIndex}]; `;
complexFilterString += `${filterMainPart},asetpts=PTS-STARTPTS[a${publicIndex}]; `;
publicIndex++;
}
});

// add part with [a0]...[a<publicIndex>]
for (let i = 1; i < publicIndex; i++) {
filterString += `[a${i}]`;
complexFilterString += `[a${i}]`;
}

filterString += `concat=n=${publicIndex - 1}:v=0:a=1`;
complexFilterString += `concat=n=${publicIndex - 1}:v=0:a=1`;

await applyFFmpegToFileInMinio(podcast.origin_file, `episodes/${podcast.slug}.mp3`, filterString)
await applyFFmpegToFileInMinio(podcast.origin_file, `episodes/${podcast.slug}.mp3`, complexFilterString)
}

async function updateFiles(request, h) {
Expand All @@ -59,7 +59,7 @@ async function updateFiles(request, h) {

console.log('publicChapters', publicChapters);

await buildPublicAudio(podcast);
await createPublicAudio(podcast);

return h.response().code(200)
}
Expand Down
8 changes: 0 additions & 8 deletions src/templates/pages/admin/admin_podcast_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
Your browser does not support the audio element.
</audio>
</div>

<div id="audio-player-container">
<audio id="audio-player" controls class="w-full">
<source src="{{audioUrl_2}}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>

</div>
<div class="my-4">
<h2 class="text-2xl">Time codes</h2>
Expand Down

0 comments on commit 725e934

Please sign in to comment.