Skip to content

Commit

Permalink
Merge pull request #93 from jontze/release/v0.3.2
Browse files Browse the repository at this point in the history
Prepare release v0.3.2
  • Loading branch information
jontze authored Feb 25, 2023
2 parents fe9c05b + 67eb985 commit 1b7306d
Show file tree
Hide file tree
Showing 17 changed files with 239 additions and 187 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/scheduled_yt-dlp_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Yt-dlp Updater
on:
workflow_dispatch:
schedule:
- cron: 57 7 * * * # At 07:57 on every day

jobs:
check:
name: Check Latest Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.latest.outputs.release }}
isNew: ${{ steps.summary.outputs.isNew }}
steps:
- uses: actions/checkout@v3
- name: Read current Yt-dlp Version
id: current
run: |
echo "version=$(cat .yt-dlprc)" >> $GITHUB_OUTPUT
- name: Latest Release
id: latest
uses: pozetroninc/[email protected]
with:
repo: yt-dlp
owner: yt-dlp
- name: Summary
id: summary
run: |
echo "# Yt-dlp Version Check" >> $GITHUB_STEP_SUMMARY
echo "The **currently** used yt-dlp version is \`${{ steps.current.outputs.version }}\`." >> $GITHUB_STEP_SUMMARY
echo "The **latest** yt-dlp version is \`${{ steps.latest.outputs.release }}\`." >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.current.outputs.version }}" = "${{ steps.latest.outputs.release }}" ]; then
echo "isNew=false" >> $GITHUB_OUTPUT
echo "The version is up to date. No update was triggered" >> $GITHUB_STEP_SUMMARY
else
echo "isNew=true" >> $GITHUB_OUTPUT
echo "A new version is available. An update was triggered." >> $GITHUB_STEP_SUMMARY
fi
update:
name: Update Version
needs:
- check
if: needs.check.outputs.isNew == 'true'
uses: ./.github/workflows/yt-dlp_update.yaml
secrets: inherit
with:
version: ${{ needs.check.outputs.version }}
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ jobs:
with:
prefix-key: "rust-${{ github.job }}"
- name: Setup yt-dlp
run: >
wget https://github.com/yt-dlp/yt-dlp/releases/download/2022.09.01/yt-dlp &&
chmod a+x yt-dlp &&
mv yt-dlp /usr/local/bin &&
run: |
VERSION=$(cat .yt-dlprc)
wget https://github.com/yt-dlp/yt-dlp/releases/download/$VERSION/yt-dlp
chmod a+x yt-dlp
mv yt-dlp /usr/local/bin
yt-dlp --version
- name: Run tests
run: cargo test --all
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/yt-dlp_update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Bump Yt-Dlp
on:
workflow_dispatch:
inputs:
version:
required: true
description: The new yt-dlp version
type: string
workflow_call:
inputs:
version:
required: true
description: The new yt-dlp version
type: string

env:
YTDLP_VERSION_FILE: .yt-dlprc

jobs:
update:
name: Update Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update .yt-dlprc
run: |
rm $YTDLP_VERSION_FILE
echo "${{ inputs.version }}" >> $YTDLP_VERSION_FILE
cat $YTDLP_VERSION_FILE
- name: Create PR
uses: peter-evans/create-pull-request@v4
with:
title: "Update yt-dlp to version `${{ inputs.version }}`"
branch: "fix/yt-dlp-version-update"
base: main
add-paths: |
${{ env.YTDLP_VERSION_FILE }}
commit-message: "fix(yt-dlp): Update yt-dlp to `${{ inputs.version }}`"
delete-branch: true
body: This is an automated Pull Request to update the yt-dlp versions that is used in the docker image.
labels: dependencies
assignees: ${{ github.repository_owner }}
reviewers: ${{ github.repository_owner }}
1 change: 1 addition & 0 deletions .yt-dlprc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023.02.17
25 changes: 25 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,28 @@ members = [
"cadency",
"examples/*"
]

[workspace.dependencies]
env_logger = "0.10.0"
log = "0.4.17"
reqwest = "0.11.14"
thiserror = "1.0.38"
serde_json = "1.0.91"
derive_builder = "0.12.0"

[workspace.dependencies.serenity]
version = "0.11.5"
default-features = false
features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"]

[workspace.dependencies.songbird]
version = "0.3.0"
features = ["builtin-queue", "yt-dlp"]

[workspace.dependencies.tokio]
version = "1.25.0"
features = ["macros", "rt-multi-thread"]

[workspace.dependencies.serde]
version = "1.0.152"
features = ["derive"]
36 changes: 19 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.62 as planner
FROM lukemathwalker/cargo-chef:latest-rust-1.67 as planner
WORKDIR /cadency
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM lukemathwalker/cargo-chef:latest-rust-1.62 as cacher
FROM lukemathwalker/cargo-chef:latest-rust-1.67 as cacher
WORKDIR /cadency
COPY --from=planner /cadency/recipe.json recipe.json
RUN apt-get update && apt-get install -y cmake && apt-get autoremove -y && \
cargo chef cook --release --recipe-path recipe.json
cargo chef cook --release --recipe-path recipe.json

FROM lukemathwalker/cargo-chef:latest-rust-1.62 as builder
FROM lukemathwalker/cargo-chef:latest-rust-1.67 as builder
WORKDIR /cadency
COPY . .
COPY --from=cacher /cadency/target target
Expand All @@ -18,32 +18,34 @@ RUN cargo build --release --bin cadency

FROM bitnami/minideb:bullseye as packages
# Downloads both ffmpeg and yt-dlp
WORKDIR packages
WORKDIR /packages
COPY --from=builder /cadency/.yt-dlprc .
# tar: (x) extract, (J) from .xz, (f) a file. (--wildcards */bin/ffmpeg) any path with /bin/ffmpeg, (--transform) remove all previous paths
# FFMPEG is staticly compiled, so platform specific
# If statement: converts architecture from docker to a correct link. Default is amd64 = desktop 64 bit
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ]; then \
export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz"; \
export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz"; \
else \
export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz"; \
export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz"; \
fi && \
apt-get update && apt-get install -y curl tar xz-utils && \
curl -L $LINK > ffmpeg.tar.xz && \
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && chmod +x yt-dlp
curl -L $LINK > ffmpeg.tar.xz && \
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz
RUN YTDLP_VERSION=$(cat .yt-dlprc) && \
curl -L https://github.com/yt-dlp/yt-dlp/releases/download/$YTDLP_VERSION/yt-dlp_linux > yt-dlp && chmod +x yt-dlp

FROM bitnami/minideb:bullseye as python-builder
# Based on: https://github.com/zarmory/docker-python-minimal/blob/master/Dockerfile
# Removes Python build and developmenttools like pip.
RUN apt-get update && apt-get install -y python3-minimal binutils && \
rm -rf /usr/local/lib/python*/ensurepip && \
rm -rf /usr/local/lib/python*/idlelib && \
rm -rf /usr/local/lib/python*/distutils/command && \
rm -rf /usr/local/lib/python*/lib2to2 && \
rm -rf /usr/local/lib/python*/__pycache__/* && \
find /usr/local/bin -not -name 'python*' \( -type f -o -type l \) -exec rm {} \;&& \
rm -rf /usr/local/share/*
rm -rf /usr/local/lib/python*/ensurepip && \
rm -rf /usr/local/lib/python*/idlelib && \
rm -rf /usr/local/lib/python*/distutils/command && \
rm -rf /usr/local/lib/python*/lib2to2 && \
rm -rf /usr/local/lib/python*/__pycache__/* && \
find /usr/local/bin -not -name 'python*' \( -type f -o -type l \) -exec rm {} \;&& \
rm -rf /usr/local/share/*

FROM bitnami/minideb:bullseye
LABEL org.opencontainers.image.source="https://github.com/jontze/cadency-rs"
Expand Down
15 changes: 6 additions & 9 deletions cadency/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cadency"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "An extensible discord bot with support with music commands"
license = "MIT"
Expand All @@ -9,17 +9,14 @@ repository = "https://github.com/jontze/cadency-rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
env_logger = "0.10.0"
log = "0.4.17"
env_logger = { workspace = true }
log = { workspace = true }
tokio = { workspace = true }

[dependencies.cadency_core]
path = "../cadency_core"
version = "0.3.1"
version = "0.3.2"

[dependencies.cadency_commands]
path = "../cadency_commands"
version = "0.3.1"

[dependencies.tokio]
version = "1.25.0"
features = ["macros", "rt-multi-thread"]
version = "0.3.2"
11 changes: 6 additions & 5 deletions cadency/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ async fn main() {
Tracks::default(),
Urban::default(),
];
let mut cadency = Cadency::default()
.await
.expect("To init Cadency")
.with_commands(commands)
.await;
let cadency = Cadency::builder()
.token(std::env::var("DISCORD_TOKEN").expect("Discord token to be present"))
.commands(commands)
.build()
.expect("To build cadency");

if let Err(why) = cadency.start().await {
error!("Client error: {:?}", why);
}
Expand Down
2 changes: 1 addition & 1 deletion cadency_codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cadency_codegen"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "Library with codegen macros for the cadency discord bot"
license = "MIT"
Expand Down
36 changes: 10 additions & 26 deletions cadency_commands/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cadency_commands"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "Library with a collection of some commands for the cadency discord bot"
license = "MIT"
Expand All @@ -9,37 +9,21 @@ repository = "https://github.com/jontze/cadency-rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
log = "0.4.17"
reqwest = "0.11.14"

[dependencies.serde]
version = "1.0.152"
features = ["derive"]

[dependencies.serenity]
version = "0.11.5"
default-features = false
features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"]

[dependencies.songbird]
version = "0.3.0"
features = ["builtin-queue", "yt-dlp"]
log = { workspace = true }
serenity = { workspace = true }
songbird = { workspace = true }
tokio = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }

[dependencies.cadency_core]
path = "../cadency_core"
version = "0.3.1"
version = "0.3.2"

[dependencies.cadency_codegen]
path = "../cadency_codegen"
version = "0.3.1"
version = "0.3.2"

[dependencies.cadency_yt_playlist]
path = "../cadency_yt_playlist"
version = "0.3.1"

[dev-dependencies.tokio]
version = "1.25.0"
features = ["macros", "rt-multi-thread"]



version = "0.3.2"
2 changes: 1 addition & 1 deletion cadency_commands/src/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use songbird::events::Event;
#[description = "Play a song from Youtube"]
#[deferred = true]
#[argument(
name = "quiery",
name = "query",
description = "URL or search query like: 'Hey Jude Beatles'",
kind = "String"
)]
Expand Down
30 changes: 8 additions & 22 deletions cadency_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
[package]
name = "cadency_core"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "Library with the core logic for the cadency discord bot"
license = "MIT"
repository = "https://github.com/jontze/cadency-rs"

[dependencies]
log = "0.4.17"
reqwest = "0.11.14"
thiserror = "1.0.38"
mockall_double = "0.3.0"
derive_builder = "0.12.0"

[dependencies.serenity]
version = "0.11.5"
default-features = false
features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"]

[dependencies.songbird]
version = "0.3.0"
features = ["builtin-queue", "yt-dlp"]

[dev-dependencies]
mockall = "0.11.3"

[dev-dependencies.tokio]
version = "1.25.0"
features = ["macros", "rt-multi-thread"]
log = { workspace = true }
serenity = { workspace = true }
songbird = { workspace = true }
tokio = { workspace = true }
reqwest = { workspace = true }
thiserror = { workspace = true }
derive_builder = { workspace = true }
Loading

0 comments on commit 1b7306d

Please sign in to comment.